Iterator Design Pattern

1. Intent

  • Provide a way to access the elements of an aggregate object sequentially without exposing its underlying representation.

  • The C++ and Java standard library abstraction that makes it possible to decouple collection classes and algorithms.

  • Promote to "full object status" the traversal of a collection

  • Polymorphic traversal

2. Problem

Need to "abstract" the traversal of wildly different data structures so that algorithms can be defined that are capable of interfacing with each transparently.

Last updated