Iterator

In computer programming, an iterator is an object that progressively provides access to each item of a collection, in order.

A collection may provide multiple iterators via its interface that provide items in different orders, such as forwards and backwards.

An iterator is often implemented in terms of the structure underlying a collection implementation and is often tightly coupled to the collection to enable the operational semantics of the iterator.

An iterator is behaviorally similar to a database cursor.

Iterators date to the CLU programming language in 1974.