Chromium Code Reviews| Index: runtime/lib/array.dart |
| diff --git a/runtime/lib/array.dart b/runtime/lib/array.dart |
| index 9980d5da6ff4edbf18a0b52a7de3afc0ead7cf5e..fe4a2748ffa72c0899cfb856f3e89b844a0aedb8 100644 |
| --- a/runtime/lib/array.dart |
| +++ b/runtime/lib/array.dart |
| @@ -88,6 +88,10 @@ class ObjectArray<E> implements List<E> { |
| return Collections.map(this, new GrowableObjectArray.withCapacity(length), f); |
| } |
| + reduce(var init, f(var prev, E element)) { |
| + return Collections.reduce(this, init, f); |
|
Lasse Reichstein Nielsen
2012/08/08 07:19:14
Same.
Anders Johnsen
2012/08/08 07:56:14
Done / see other comments.
|
| + } |
| + |
| Collection<E> filter(bool f(E element)) { |
| return Collections.filter(this, new GrowableObjectArray<E>(), f); |
| } |
| @@ -220,6 +224,10 @@ class ImmutableArray<E> implements List<E> { |
| return Collections.map(this, new GrowableObjectArray.withCapacity(length), f); |
| } |
| + reduce(var init, f(var prev, E element)) { |
| + return Collections.reduce(this, init, f); |
| + } |
| + |
| Collection<E> filter(bool f(E element)) { |
| return Collections.filter(this, new GrowableObjectArray<E>(), f); |
| } |