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

Unified Diff: runtime/lib/array.dart

Issue 14071002: Added new version of reduce. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Removed more uses of max, and a few bugs. Created 7 years, 8 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/array.dart
diff --git a/runtime/lib/array.dart b/runtime/lib/array.dart
index 37efab9c7f4d7d7ebba390d179f0a7049ac21d89..0f10ceb2b541e9a3cbb45015e3080469044183fb 100644
--- a/runtime/lib/array.dart
+++ b/runtime/lib/array.dart
@@ -114,8 +114,8 @@ class _ObjectArray<E> implements List<E> {
return IterableMixinWorkaround.mapList(this, f);
}
- reduce(initialValue, combine(previousValue, E element)) {
- return IterableMixinWorkaround.reduce(this, initialValue, combine);
+ E reduce(E combine(E value, E element)) {
+ return IterableMixinWorkaround.reduce(this, combine);
}
fold(initialValue, combine(previousValue, E element)) {
@@ -234,10 +234,6 @@ class _ObjectArray<E> implements List<E> {
throw new StateError("More than one element");
}
- E min([int compare(E a, E b)]) => IterableMixinWorkaround.min(this, compare);
-
- E max([int compare(E a, E b)]) => IterableMixinWorkaround.max(this, compare);
-
List<E> toList({ bool growable: true}) {
return new List<E>.from(this, growable: growable);
}
@@ -361,8 +357,8 @@ class _ImmutableArray<E> implements List<E> {
return IterableMixinWorkaround.joinList(this, separator);
}
- reduce(initialValue, combine(previousValue, E element)) {
- return IterableMixinWorkaround.reduce(this, initialValue, combine);
+ E reduce(E combine(E value, E element)) {
+ return IterableMixinWorkaround.reduce(this, combine);
}
fold(initialValue, combine(previousValue, E element)) {
@@ -486,10 +482,6 @@ class _ImmutableArray<E> implements List<E> {
throw new StateError("More than one element");
}
- E min([int compare(E a, E b)]) => IterableMixinWorkaround.min(this, compare);
-
- E max([int compare(E a, E b)]) => IterableMixinWorkaround.max(this, compare);
-
List<E> toList({ bool growable: true }) {
return new List<E>.from(this, growable: growable);
}

Powered by Google App Engine
This is Rietveld 408576698