Provide a way to access the elements of an aggregate object sequentially without exposing its underlying representation.
提供一种方法访问一个容器对象中各个元素,而又不需暴露该对象的内部细节。
The classes and objects participating in this pattern are:
- defines an interface for accessing and traversing elements.
- implements the Iterator interface.
- keeps track of the current position in the traversal of the aggregate.
- defines an interface for creating an Iterator object
- implements the Iterator creation interface to return an instance of the proper ConcreteIterator