The iterator pattern is a design pattern which provides a way to access the elements of an aggregate object sequentially without exposing its underlying representation. The iterator pattern decouples algorithms from containers; in some cases, algorithms are necessarily container-specific and thus cannot be decoupled.