Iterator deseni, bir koleksiyonu sırayla geçmek için bir yol sağlar ve iç yapısını açığa çıkarmaz. Bu, modern çoğu dilde yerleşik olduğundan çok temeldir (for-of döngüleri, iteratörler, generatörler).
Iterator deseni ne yapar?
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"
