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

Unified Diff: runtime/lib/growable_array.dart

Issue 10832060: Add reduce to Collection. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 5 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 772bec094e769e32a610ac7cb4b0d07adc5184db..c993a23dfad23b4d056dd11bc263947385d0cb10 100644
--- a/runtime/lib/growable_array.dart
+++ b/runtime/lib/growable_array.dart
@@ -180,6 +180,10 @@ class GrowableObjectArray<T> implements List<T> {
new GrowableObjectArray.withCapacity(length), f);
}
+ reduce(var init, f(var prev, E element)) {
+ return Collections.reduce(this, init, f);
+ }
+
Collection<T> filter(bool f(T element)) {
return Collections.filter(this, new GrowableObjectArray<T>(), f);
}

Powered by Google App Engine
This is Rietveld 408576698