Le motif Itérateur fournit un moyen de parcourir une collection séquentiellement sans exposer sa structure interne. C'est tellement fondamental que c'est intégré dans la plupart des langages modernes (boucles for-of, itérateurs, générateurs).
Ce que fait le motif Itérateur
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"
