It accesses the elements of a collection object sequentially without any need to know its underlying representation.
The collection can be a List, Set, Array and it can be anything.
In OOPs, Iterator pattern is a design pattern in which an iterator is used to traverse a container and access the container’s elements.
Abstract the details of traversing the collections. Example: Different types of collections in an application such as an array, linked list, etc. We can traverse and iterate the elements without knowing the actual implementation.
Real Life Examples of Iterator Design Pattern
UML Class Diagram of Iterator Design Pattern
Iterator Design Pattern Java Implementation
public class Voltage
private int voltage;
public Voltage(int v)
this.voltage = v;
public int getVolts()
public void setVolts(int voltage)
this.voltage = voltage;