| 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 350 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 361 Set<E> toSet() => new Set<E>.from(this); | 361 Set<E> toSet() => new Set<E>.from(this); |
| 362 | 362 |
| 363 /** | 363 /** |
| 364 * Returns the number of elements in [this]. | 364 * Returns the number of elements in [this]. |
| 365 * | 365 * |
| 366 * Counting all elements may involve iterating through all elements and can | 366 * Counting all elements may involve iterating through all elements and can |
| 367 * therefore be slow. | 367 * therefore be slow. |
| 368 * Some iterables have a more efficient way to find the number of elements. | 368 * Some iterables have a more efficient way to find the number of elements. |
| 369 */ | 369 */ |
| 370 int get length { | 370 int get length { |
| 371 assert(this is! EfficientLengthIterable); | 371 assert(this is! EfficientLength); |
| 372 int count = 0; | 372 int count = 0; |
| 373 Iterator it = iterator; | 373 Iterator it = iterator; |
| 374 while (it.moveNext()) { | 374 while (it.moveNext()) { |
| 375 count++; | 375 count++; |
| 376 } | 376 } |
| 377 return count; | 377 return count; |
| 378 } | 378 } |
| 379 | 379 |
| 380 /** | 380 /** |
| 381 * Returns `true` if there are no elements in this collection. | 381 * Returns `true` if there are no elements in this collection. |
| (...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 647 */ | 647 */ |
| 648 abstract class BidirectionalIterator<E> implements Iterator<E> { | 648 abstract class BidirectionalIterator<E> implements Iterator<E> { |
| 649 /** | 649 /** |
| 650 * Move back to the previous element. | 650 * Move back to the previous element. |
| 651 * | 651 * |
| 652 * Returns true and updates [current] if successful. Returns false | 652 * Returns true and updates [current] if successful. Returns false |
| 653 * and sets [current] to null if there is no previous element. | 653 * and sets [current] to null if there is no previous element. |
| 654 */ | 654 */ |
| 655 bool movePrevious(); | 655 bool movePrevious(); |
| 656 } | 656 } |
| OLD | NEW |