Iterator Class

The Iterator class encapsulates the behavior required to sequentially access elements of a collection.

Instances of the Iterator class are referred to as iterators. Use iterators to iterate two or more collections where the iterations are not nested or when the state of an iteration (that is, the position in a collection) needs to be remembered and the iteration resumed later. (The foreach instruction enables you to iterate through two collections simultaneously only if one iteration is nested within the other.) The order in which instances are returned when iterating a virtual collection is not significant.

Create an iterator by using the createIterator method of the Collection class. (Instances of the Dictionary class provide methods that enable you to specify the start position of an iterator.)

For details about the methods defined in the Iterator class, see "Iterator Methods", in the following subsection.

Object

ArrayIterator, DictIterator, ExternalIterator, MergeIterator, SetIterator, SetMergeIterator