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 * An object that uses an [Iterator] to serve objects one at a time. | 8 * An object that uses an [Iterator] to serve objects one at a time. |
9 * | 9 * |
10 * You can iterate over all objects served by an Iterable object | 10 * You can iterate over all objects served by an Iterable object |
(...skipping 13 matching lines...) Expand all Loading... |
24 * | 24 * |
25 * You can implement Iterable in your own class. | 25 * You can implement Iterable in your own class. |
26 * If you do, then an instance of your Iterable class | 26 * If you do, then an instance of your Iterable class |
27 * can be the right-hand side of a for-in construct. | 27 * can be the right-hand side of a for-in construct. |
28 * | 28 * |
29 * Some subclasss of [Iterable] can be modified. It is generally not allowed | 29 * Some subclasss of [Iterable] can be modified. It is generally not allowed |
30 * to modify such collections while they are being iterated. Doing so will break | 30 * to modify such collections while they are being iterated. Doing so will break |
31 * the iteration, which is typically signalled by throwing a | 31 * the iteration, which is typically signalled by throwing a |
32 * [ConcurrentModificationError] when it is detected. | 32 * [ConcurrentModificationError] when it is detected. |
33 */ | 33 */ |
34 @SupportJsExtensionMethods() | |
35 abstract class Iterable<E> { | 34 abstract class Iterable<E> { |
36 const Iterable(); | 35 const Iterable(); |
37 | 36 |
38 /** | 37 /** |
39 * Creates an Iterable that generates its elements dynamically. | 38 * Creates an Iterable that generates its elements dynamically. |
40 * | 39 * |
41 * The Iterators created by the Iterable count from | 40 * The Iterators created by the Iterable count from |
42 * zero to [:count - 1:] while iterating, and call [generator] | 41 * zero to [:count - 1:] while iterating, and call [generator] |
43 * with that index to create the next value. | 42 * with that index to create the next value. |
44 * | 43 * |
(...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
371 */ | 370 */ |
372 abstract class BidirectionalIterator<E> implements Iterator<E> { | 371 abstract class BidirectionalIterator<E> implements Iterator<E> { |
373 /** | 372 /** |
374 * Move back to the previous element. | 373 * Move back to the previous element. |
375 * | 374 * |
376 * Returns true and updates [current] if successful. Returns false | 375 * Returns true and updates [current] if successful. Returns false |
377 * and sets [current] to null if there is no previous element. | 376 * and sets [current] to null if there is no previous element. |
378 */ | 377 */ |
379 bool movePrevious(); | 378 bool movePrevious(); |
380 } | 379 } |
OLD | NEW |