April 2004
Intermediate to advanced
520 pages
10h 10m
English
This pattern was previously described in GoF95.
The Iterator pattern allows a client object to access the contents of a container in a sequential manner, without having any knowledge about the internal representation of its contents.
The term container, used above, can simply be defined as a collection of data or objects. The objects within the container could in turn be collections, making it a collection of collections. The Iterator pattern enables a client object to traverse through this collection of objects (or the container) without having the container to reveal how the data is stored internally.
To accomplish this, the Iterator pattern suggests that a Container object should be designed to provide a public ...