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

Unified Diff: runtime/lib/growable_array.dart

Issue 10827293: Reapply 'Add reduce to Collection.' (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Add fixes. 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
Index: runtime/lib/growable_array.dart
diff --git a/runtime/lib/growable_array.dart b/runtime/lib/growable_array.dart
index 772bec094e769e32a610ac7cb4b0d07adc5184db..5a1ba161ede5a24ecb34faf9dca1ae9334e9f79a 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, T element)) {
+ return Collections.reduce(this, initialValue, combine);
+ }
+
Collection<T> filter(bool f(T element)) {
return Collections.filter(this, new GrowableObjectArray<T>(), f);
}

Powered by Google App Engine
This is Rietveld 408576698