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

Unified Diff: sdk/lib/_internal/compiler/implementation/lib/js_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: 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: sdk/lib/_internal/compiler/implementation/lib/js_array.dart
diff --git a/sdk/lib/_internal/compiler/implementation/lib/js_array.dart b/sdk/lib/_internal/compiler/implementation/lib/js_array.dart
index ccb9e0a2d909758020f9c344fc26b4e6047ade24..01ebc02efd470cd9233a2e970325009f1ed5409e 100644
--- a/sdk/lib/_internal/compiler/implementation/lib/js_array.dart
+++ b/sdk/lib/_internal/compiler/implementation/lib/js_array.dart
@@ -142,6 +142,10 @@ class JSArray<E> implements List<E> {
throw new StateError("More than one element");
}
+ E min([int compare(E a, E b)]) => Collections.min(this, compare);
+
+ E max([int compare(E a, E b)]) => Collections.max(this, compare);
+
void removeRange(int start, int length) {
checkGrowable(this, 'removeRange');
if (length == 0) {

Powered by Google App Engine
This is Rietveld 408576698