Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(162)

Unified Diff: runtime/lib/growable_array.dart

Issue 11727007: Add min and max to Iterable and Stream. (Closed) Base URL: https://dart.googlecode.com/svn/experimental/lib_v2/dart
Patch Set: Address review comments. Fix T->E in Iterable. Created 7 years, 12 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: runtime/lib/growable_array.dart
diff --git a/runtime/lib/growable_array.dart b/runtime/lib/growable_array.dart
index f3a16fe52027e0dedfe9f8ae1bf2ed193d96eb5a..8b212990674a25fdeb3d080e85973c7e7435344d 100644
--- a/runtime/lib/growable_array.dart
+++ b/runtime/lib/growable_array.dart
@@ -161,6 +161,10 @@ class _GrowableObjectArray<T> implements List<T> {
throw new StateError("More than one element");
}
+ int min([int compare(int a, int b)]) => Collections.min(this, compare);
+
+ int max([int compare(int a, int b)]) => Collections.max(this, compare);
+
int indexOf(T element, [int start = 0]) {
return Arrays.indexOf(this, element, start, length);
}

Powered by Google App Engine
This is Rietveld 408576698