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

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: Use Dynamic as type. Created 8 years, 4 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
« no previous file with comments | « runtime/lib/array.dart ('k') | tests/corelib/collection_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/lib/growable_array.dart
diff --git a/runtime/lib/growable_array.dart b/runtime/lib/growable_array.dart
index 772bec094e769e32a610ac7cb4b0d07adc5184db..de395992e387ffeafc76f16199490f5c1ab02b3b 100644
--- a/runtime/lib/growable_array.dart
+++ b/runtime/lib/growable_array.dart
@@ -180,6 +180,11 @@ class GrowableObjectArray<T> implements List<T> {
new GrowableObjectArray.withCapacity(length), f);
}
+ Dynamic reduce(Dynamic initialValue,
+ Dynamic combine(Dynamic previousValue, E element)) {
+ return Collections.reduce(this, initialValue, combine);
+ }
+
Collection<T> filter(bool f(T element)) {
return Collections.filter(this, new GrowableObjectArray<T>(), f);
}
« no previous file with comments | « runtime/lib/array.dart ('k') | tests/corelib/collection_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698