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

Unified Diff: corelib/src/implementation/queue.dart

Issue 10854118: Add reduce to Queue. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: 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 | « no previous file | tests/corelib/collection_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: corelib/src/implementation/queue.dart
diff --git a/corelib/src/implementation/queue.dart b/corelib/src/implementation/queue.dart
index 82e4dd094f51700948b26898b136372dc1544bd0..ef3c5ef1fa73ee53fff068aa10dbbe3ae01ced87 100644
--- a/corelib/src/implementation/queue.dart
+++ b/corelib/src/implementation/queue.dart
@@ -216,6 +216,10 @@ class DoubleLinkedQueue<E> implements Queue<E> {
return other;
}
+ Dynamic reduce(Dynamic initialValue,
+ Dynamic combine(Dynamic previousValue, E element)) {
+ return Collections.reduce(this, initialValue, combine);
+ }
Queue<E> filter(bool f(E element)) {
Queue<E> other = new Queue<E>();
« no previous file with comments | « no previous file | tests/corelib/collection_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698