Skip to main content

Iterator

The Iterator design pattern provides a way to access the elements of an aggregate object sequentially without exposing its underlying representation.

Usage     Usage     High

UML class diagram​

A visualization of the classes and objects participating in this pattern.

diagram

Sample code​

This structural code demonstrates the Iterator pattern which provides for a way to traverse (iterate) over a collection of items without detailing the underlying structure of the collection.

Output​

See also​

​