
This is done by creating a common interface that all the different collection classes share. Then an iterator is provided to traverse the objects they contain.
Because all different Collection classes share a common interface they can be treated polymorphically and it eliminate duplicate code.
Below is the video tutorial for the Iterator pattern

No comments:
Post a Comment