Iterator Design Pattern (UML Diagrams)

The Iteration design pattern describes how to iterate a collection so that the iteration algorithm is decoupled from the collection class.

The iterator pattern allows you to define various traversing algorithms for a collection. You may define a forward and backward iteration of a list, breadth-first and depth-first iteration of a tree, etc. The collection is represented by the Aggregate role and the traversing algorithm is defined by the Iterator role.

Design Pattern Parts

The iterator design pattern defines these roles:

  • Iterator - traversing algorithm
  • Concrete Iterator
  • Aggregate - collection of objects
  • Concrete Aggregate

Iterator Pattern in Diagrams

The iterator design pattern structure depicted in UML class diagram and the behavior shown in UML sequence diagram.

Iterator Design Pattern (UML Class Diagram)
Iterator Design Pattern (UML Class Diagram)

Download Iterator Pattern Diagrams

Download Iterator Design Pattern Diagrams (Software Ideas Modeler Project - Iterator.simp)

New Comment

Comment