Iterator design pattern

E679869

The Iterator design pattern is a behavioral pattern that provides a standard way to sequentially access elements of a collection or aggregate object without exposing its underlying representation.

All labels observed (2)

How this entity was disambiguated

Statements (49)

Predicate Object
instanceOf behavioral design pattern ⓘ
software design pattern ⓘ
alternativeName Cursor pattern ⓘ
applicableWhen you need multiple ways to traverse a collection ⓘ
you want to keep collection classes focused on storage rather than traversal ⓘ
you want to provide a uniform interface for traversing different aggregate structures ⓘ
belongsTo Gang of Four design patterns ⓘ
canBeExtendedWith filtered iteration ⓘ
lazy iteration ⓘ
reverse iteration ⓘ
canSupport internal iteration ⓘ
category behavioral pattern ⓘ
consequence increases number of objects in the system ⓘ
simplifies aggregate interface ⓘ
supports multiple simultaneous traversals of the same aggregate ⓘ
decouples collection structure from traversal algorithm ⓘ
definesOperation currentItem() ⓘ
first() ⓘ
hasNext() ⓘ
next() ⓘ
definesRole Aggregate defines interface for creating an iterator object ⓘ
ConcreteAggregate implements iterator creation for a concrete collection ⓘ
ConcreteIterator implements traversal for a specific aggregate ⓘ
Iterator provides interface for accessing and traversing elements ⓘ
describedIn Design Patterns: Elements of Reusable Object-Oriented Software ⓘ
encapsulates traversal logic of a collection ⓘ
ensures clients do not need to know collection’s internal data structure ⓘ
goal allow clients to traverse collections without depending on their concrete classes ⓘ
hides internal representation of aggregate objects ⓘ
participants Aggregate ⓘ
ConcreteAggregate ⓘ
ConcreteIterator ⓘ
Iterator ⓘ
linked to: Iterator pattern
primaryIntent provide a way to access elements of an aggregate object sequentially without exposing its underlying representation ⓘ
promotes open/closed principle for traversal strategies ⓘ
single responsibility principle for collections ⓘ
relatedTo Composite design pattern ⓘ
linked to: Composite pattern

Factory Method design pattern ⓘ
linked to: Factory Method
supports different traversal strategies for the same aggregate ⓘ
external iteration ⓘ
polymorphic iteration over different collection types ⓘ
sequential access to elements ⓘ
uniform traversal over arrays, lists, trees, and other aggregates ⓘ
typicalMethodName begin() ⓘ
end() ⓘ
iterator() ⓘ
usedIn .NET collections ⓘ
C++ Standard Template Library ⓘ
Java Collections Framework ⓘ
linked to: Java Class Library

How these facts were elicited

Referenced by (2)

Full triples — surface form annotated when it differs from this entity's canonical label.

Composite → relatedTo → Iterator design pattern ⓘ
Iterator design pattern → definesRole → ConcreteIterator implements traversal for a specific aggregate ⓘ
linked to: Iterator design pattern