Dart API Referencedart:coreIterator<E>

Iterator<E> abstract class

The Iterator class provides methods to iterate over an object. It is transparently used by the for-in construct to test for the end of the iteration, and to get the elements.

If the object iterated over is changed during the iteration, the behavior is unspecified.

abstract class Iterator<E> {
  /**
   * Gets the next element in the iteration. Throws a
   * [NoMoreElementsException] if no element is left.
   */
  E next();

  /**
   * Returns whether the [Iterator] has elements left.
   */
  bool hasNext();
}

Subclasses

ConcreteTypeCartesianProductIterator, ConsDartStringIterator, HashSetIterator<E>, HierarchyIterator, LinkIterator<T>, SequenceIterator<E>, StringCodeIterator, StringEscapeIterator, Utf16CodeUnitDecoder, Utf8Decoder

Methods

bool hasNext() #

Returns whether the Iterator has elements left.

bool hasNext();

E next() #

Gets the next element in the iteration. Throws a NoMoreElementsException if no element is left.

E next();