Index: sdk/lib/collection/collections.dart |
diff --git a/sdk/lib/collection/collections.dart b/sdk/lib/collection/collections.dart |
index f51d98daaabeb87b5ab5bb1613a0f12e4fd5cc6e..2cad54126735bc79756f6f91e34e46a3ffed949b 100644 |
--- a/sdk/lib/collection/collections.dart |
+++ b/sdk/lib/collection/collections.dart |
@@ -39,9 +39,14 @@ class IterableMixinWorkaround { |
} |
static dynamic reduce(Iterable iterable, |
- dynamic initialValue, |
- dynamic combine(dynamic previousValue, element)) { |
- return fold(iterable, initialValue, combine); |
+ dynamic combine(previousValue, element)) { |
+ Iterator iteator = iterable.iterator; |
floitsch
2013/04/10 15:14:07
iterator
Lasse Reichstein Nielsen
2013/04/11 08:00:23
Done.
|
+ if (!iterator.moveNext()) throw new StateError("No elements"); |
+ var value = iterator.current; |
+ while (iterator.moveNext()) { |
+ value = combine(value, iterator.current); |
+ } |
+ return value; |
} |
static dynamic fold(Iterable iterable, |