An interface for getting items, one at a time, from an object.
The for-in construct transparently usesIterator to test for the endof the iteration, and to get each item (orelement).
If the object iterated over is changed during the iteration, thebehavior is unspecified.
TheIterator is initially positioned before the first element.Before accessing the first element the iterator must thus be advanced usingmoveNext to point to the first element.If no element is left, thenmoveNext returns false,and all further calls tomoveNext will also return false.
Thecurrent value must not be accessed before callingmoveNextor after a call tomoveNext has returned false.
A typical usage of anIterator looks as follows:
var it = obj.iterator;while (it.moveNext()) { use(it.current);}See also:Iterationin thelibrary tour
- Implementers
Properties
- current→ E
- The current element.no setter
- hashCode→int
- The hash code for this object.no setterinherited
- runtimeType→Type
- A representation of the runtime type of the object.no setterinherited
Methods
- moveNext(
)→bool - Advances the iterator to the next element of the iteration.
- noSuchMethod(
Invocationinvocation)→ dynamic - Invoked when a nonexistent method or property is accessed.inherited
- toString(
)→String - A string representation of this object.inherited
Operators
- operator ==(
Objectother)→bool - The equality operator.inherited