| OLD | NEW |
| 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 part of dart.core; | 5 part of dart.core; |
| 6 | 6 |
| 7 /** | 7 /** |
| 8 * A collection of values, or "elements", that can be accessed sequentially. | 8 * A collection of values, or "elements", that can be accessed sequentially. |
| 9 * | 9 * |
| 10 * The elements of the iterable are accessed by getting an [Iterator] | 10 * The elements of the iterable are accessed by getting an [Iterator] |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 99 factory Iterable.generate(int count, [E generator(int index)]) { | 99 factory Iterable.generate(int count, [E generator(int index)]) { |
| 100 if (count <= 0) return new EmptyIterable<E>(); | 100 if (count <= 0) return new EmptyIterable<E>(); |
| 101 return new _GeneratorIterable<E>(count, generator); | 101 return new _GeneratorIterable<E>(count, generator); |
| 102 } | 102 } |
| 103 | 103 |
| 104 /** | 104 /** |
| 105 * Creates an empty iterable. | 105 * Creates an empty iterable. |
| 106 * | 106 * |
| 107 * The empty iterable has no elements, and iterating it always stops | 107 * The empty iterable has no elements, and iterating it always stops |
| 108 * immediately. | 108 * immediately. |
| 109 * | |
| 110 * An empty iterable can be used in places where you always that | |
| 111 * the iterable you would otherwise create is empty. | |
| 112 */ | 109 */ |
| 113 const factory Iterable.empty() = EmptyIterable<E>; | 110 const factory Iterable.empty() = EmptyIterable<E>; |
| 114 | 111 |
| 115 /** | 112 /** |
| 116 * Returns a new `Iterator` that allows iterating the elements of this | 113 * Returns a new `Iterator` that allows iterating the elements of this |
| 117 * `Iterable`. | 114 * `Iterable`. |
| 118 * | 115 * |
| 119 * Iterable classes may specify the iteration order of their elements | 116 * Iterable classes may specify the iteration order of their elements |
| 120 * (for example [List] always iterate in index order), | 117 * (for example [List] always iterate in index order), |
| 121 * or they may leave it unspecified (for example a hash-based [Set] | 118 * or they may leave it unspecified (for example a hash-based [Set] |
| (...skipping 554 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 676 */ | 673 */ |
| 677 abstract class BidirectionalIterator<E> implements Iterator<E> { | 674 abstract class BidirectionalIterator<E> implements Iterator<E> { |
| 678 /** | 675 /** |
| 679 * Move back to the previous element. | 676 * Move back to the previous element. |
| 680 * | 677 * |
| 681 * Returns true and updates [current] if successful. Returns false | 678 * Returns true and updates [current] if successful. Returns false |
| 682 * and sets [current] to null if there is no previous element. | 679 * and sets [current] to null if there is no previous element. |
| 683 */ | 680 */ |
| 684 bool movePrevious(); | 681 bool movePrevious(); |
| 685 } | 682 } |
| OLD | NEW |