Modelul Iterator oferă o modalitate de a traversa o colecție secvențial fără a expune structura sa internă. Este atât de fundamental încât este încorporat în majoritatea limbajelor moderne (bucle for-of, iteratori, generatori).
Ce face modelul Iterator
ITERATOR → access elements of a collection SEQUENTIALLY without exposing its internals:
→ provides a standard way to traverse (next element, has more?)
→ the collection's internal structure (array, tree, linked list) is HIDDEN
→ decouples traversal logic from the collection
→ "iterate without caring how the collection is structured"
