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

Unified Diff: corelib/src/implementation/hash_map_set.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: corelib/src/implementation/hash_map_set.dart
diff --git a/corelib/src/implementation/hash_map_set.dart b/corelib/src/implementation/hash_map_set.dart
index c538951fff31beb62674103b8c7517339c0c8ded..6141967d93c76401709859b63d09efedc7e0bd67 100644
--- a/corelib/src/implementation/hash_map_set.dart
+++ b/corelib/src/implementation/hash_map_set.dart
@@ -350,6 +350,10 @@ class HashSetImplementation<E extends Hashable> implements HashSet<E> {
return result;
}
+ reduce(var init, f(var prev, E element)) {
Lasse Reichstein Nielsen 2012/08/08 07:19:14 Return type, variable names unabbreviated.
Anders Johnsen 2012/08/08 07:56:14 Done / see other comments.
+ return Collections.reduce(this, init, f);
+ }
+
Set<E> filter(bool f(E element)) {
Set<E> result = new Set<E>();
_backingMap.forEach(void _(E key, E value) {

Powered by Google App Engine
This is Rietveld 408576698