| OLD | NEW | 
|---|
| 1 // Copyright (c) 2012, the Dart project authors.  Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 interface for getting items, one at a time, from an object. | 8  * An interface for getting items, one at a time, from an object. | 
| 9  * | 9  * | 
| 10  * The for-in construct transparently uses Iterator to test for the end | 10  * The for-in construct transparently uses `Iterator` to test for the end | 
| 11  * of the iteration, and to get each item (or _element_). | 11  * of the iteration, and to get each item (or _element_). | 
| 12  * | 12  * | 
| 13  * If the object iterated over is changed during the iteration, the | 13  * If the object iterated over is changed during the iteration, the | 
| 14  * behavior is unspecified. | 14  * behavior is unspecified. | 
| 15  * | 15  * | 
| 16  * The Iterator is initially positioned before the first element. Before | 16  * The `Iterator` is initially positioned before the first element. | 
| 17  * accessing the first element the iterator must thus be advanced ([moveNext]) | 17  * Before accessing the first element the iterator must thus be advanced using | 
| 18  * to point to the first element. If no element is left, then [moveNext] | 18  * [moveNext] to point to the first element. | 
| 19  * returns false. | 19  * If no element is left, then [moveNext] returns false, [current] | 
|  | 20  * returns `null`, and all further calls to [moveNext] will also return false. | 
| 20  * | 21  * | 
| 21  * A typical usage of an Iterator looks as follows: | 22  * A typical usage of an Iterator looks as follows: | 
| 22  * | 23  * | 
| 23  *     var it = obj.iterator; | 24  *     var it = obj.iterator; | 
| 24  *     while (it.moveNext()) { | 25  *     while (it.moveNext()) { | 
| 25  *       use(it.current); | 26  *       use(it.current); | 
| 26  *     } | 27  *     } | 
| 27  * | 28  * | 
| 28  * **See also:** [Iteration] | 29  * **See also:** | 
| 29  * (http://www.dartlang.org/docs/dart-up-and-running/contents/ch03.html#ch03-ite
    ration) | 30  * [Iteration](http://www.dartlang.org/docs/dart-up-and-running/contents/ch03.ht
    ml#iteration) | 
| 30  * in the [library tour] | 31  * in the [library tour](http://www.dartlang.org/docs/dart-up-and-running/conten
    ts/ch03.html) | 
| 31  * (http://www.dartlang.org/docs/dart-up-and-running/contents/ch03.html) |  | 
| 32  */ | 32  */ | 
| 33 abstract class Iterator<E> { | 33 abstract class Iterator<E> { | 
| 34   /** | 34   /** | 
| 35    * Moves to the next element. Returns true if [current] contains the next | 35    * Moves to the next element. | 
| 36    * element. Returns false, if no element was left. | 36    * | 
|  | 37    * Returns true if [current] contains the next element. | 
|  | 38    * Returns false if no elements are left. | 
| 37    * | 39    * | 
| 38    * It is safe to invoke [moveNext] even when the iterator is already | 40    * It is safe to invoke [moveNext] even when the iterator is already | 
| 39    * positioned after the last element. In this case [moveNext] has no effect. | 41    * positioned after the last element. | 
|  | 42    * In this case [moveNext] returns false again and has no effect. | 
|  | 43    * | 
|  | 44    * A call to `moveNext` may throw if iteration has been broken by | 
|  | 45    * changing the underlying collection. | 
| 40    */ | 46    */ | 
| 41   bool moveNext(); | 47   bool moveNext(); | 
| 42 | 48 | 
| 43   /** | 49   /** | 
| 44    * Returns the current element. | 50    * Returns the current element. | 
| 45    * | 51    * | 
| 46    * Return [:null:] if the iterator has not yet been moved to the first | 52    * Returns `null` if the iterator has not yet been moved to the first | 
| 47    * element, or if the iterator has been moved after the last element of the | 53    * element, or if the iterator has been moved past the last element of the | 
| 48    * [Iterable]. | 54    * [Iterable]. | 
|  | 55    * | 
|  | 56    * The `current` getter should keep its value until the next call to | 
|  | 57    * [moveNext], even if an underlying collection changes. | 
|  | 58    * After a successful call to `moveNext`, the user doesn't need to cache | 
|  | 59    * the current value, but can keep reading it from the iterator. | 
| 49    */ | 60    */ | 
| 50   E get current; | 61   E get current; | 
| 51 } | 62 } | 
| OLD | NEW | 
|---|