Source: wikibot/iterator-pattern

= Iterator pattern
{wiki=Iterator_pattern}

The Iterator Pattern is a design pattern that provides a way to access the elements of a collection (like arrays, lists, or trees) sequentially without exposing the underlying representation of the collection. It is part of the behavioral design patterns category in software engineering. \#\#\# Key Components of the Iterator Pattern 1. **Iterator**: This is an interface that defines methods for traversing the collection. Common methods include: - \`next()\`: Returns the next element in the iteration.