Chromium Code Reviews| Index: corelib/src/implementation/collections.dart |
| diff --git a/corelib/src/implementation/collections.dart b/corelib/src/implementation/collections.dart |
| index 462d33af2a703382ecf34f320b5b8d8ca1a0913a..9ea332443653b5ec10979bd35fa72c5b15b0bf51 100644 |
| --- a/corelib/src/implementation/collections.dart |
| +++ b/corelib/src/implementation/collections.dart |
| @@ -35,6 +35,13 @@ class Collections { |
| return destination; |
| } |
| + static reduce(Iterable iterable, var init, f(prev, element)) { |
|
Lasse Reichstein Nielsen
2012/08/08 07:19:14
Add return value, even if it's just Object. It dif
Anders Johnsen
2012/08/08 07:56:14
Adding var does not provide any further informatio
Lasse Reichstein Nielsen
2012/08/10 11:26:56
Accepted, but not liked.
I prefer being explicit a
|
| + for (final e in iterable) { |
|
Lasse Reichstein Nielsen
2012/08/08 07:19:14
Yes, that means using 'element' instead of 'e'. It
Anders Johnsen
2012/08/08 07:56:14
It's using the style from the rest of the file/lib
Lasse Reichstein Nielsen
2012/08/10 11:26:56
We do. We shoud. Please start here :)
Anders Johnsen
2012/11/12 12:02:56
Done.
|
| + init = f(init, e); |
| + } |
| + return init; |
| + } |
| + |
| static List filter(Iterable source, List destination, bool f(o)) { |
| for (final e in source) { |
| if (f(e)) destination.add(e); |