this pattern is used when the data structure is variable and you want to iterate through it, like when its can be fixed size array or list or ...
and base on that iterate itself handle diffrently, then we use this pattern to hide the iterate from the user who just want iterate
- ConcreteIterator - contains methods for handle iterate on its way
- ConcreteAggregate - contains data structure and createIteretor method
- Interface Iterator - contains hasNext and next methods
ConcreteIterator |
-hasNext(): bool |
-next(): Object |
ConcreteAggregate |
-createIterator: Iterator |