Chromium Code Reviews| Index: sdk/lib/core/iterable.dart |
| diff --git a/sdk/lib/core/iterable.dart b/sdk/lib/core/iterable.dart |
| index e435b1e7680786539216842297b416d9cc6541e1..616009d2b79b9c7cf044bede4d2410470654d3cd 100644 |
| --- a/sdk/lib/core/iterable.dart |
| +++ b/sdk/lib/core/iterable.dart |
| @@ -102,6 +102,17 @@ abstract class Iterable<E> { |
| } |
| /** |
| + * Creates an empty iterable. |
| + * |
| + * The empty iterable has no elements, and iterating it always stops |
| + * immediately. |
| + * |
| + * An empty iterable can be used in places where you always know that |
| + * the iterable you would otherwise is always empty. |
|
Søren Gjesse
2015/05/21 09:10:06
Seems like there is a word missing after "otherwis
|
| + */ |
| + const factory Iterable.empty() = EmptyIterable<E>; |
|
kevmoo
2015/05/21 15:07:06
Why is this useful over using `const []`?
Lasse Reichstein Nielsen
2015/05/21 15:16:51
Because const[] is a List, not just an Iterable.
Y
|
| + |
| + /** |
| * Returns a new `Iterator` that allows iterating the elements of this |
| * `Iterable`. |
| * |