Iterator প্যাটার্ন একটি কালেকশন ক্রমিকভাবে ট্রাভার্স করার উপায় প্রদান করে এর আভ্যন্তরীণ কাঠামো উন্মোচন না করে। এটি এতটাই মৌলিক যে এটি বেশিরভাগ আধুনিক ভাষায় নির্মিত (for-of লুপ, iterators, generators)।
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"
আধুনিক ভাষায় নির্মিত
( item collection) { }
* () { ( i = ; i < n; i++) i; }
( i ()) .(i);
