Check out the example folder to see how the pattern is used.
Real-world example
Imagine you are using an internet browser, we need to be able to go to the previous url upon clicking the back button. Basically, we need a way to iterate through the url list.
In plain words
It presents a way to access the elements of an object without exposing the underlying presentation.
Wikipedia says
In object-oriented programming, the iterator pattern is a design pattern in which an iterator is used to traverse a container and access the container's elements. The iterator pattern decouples algorithms from containers; in some cases, algorithms are necessarily container-specific and thus cannot be decoupled.