Signing you in…

Iterator

Iterator is a behavioral pattern that lets you traverse elements of a collection without exposing its underlying representation — whether it's an array, linked list, tree, or graph. You provide a uniform traversal interface regardless of the internal data structure. Java's for-each loop is the most visible manifestation: it works the same way on an ArrayList, a LinkedList, a TreeSet, or your own custom collection.

ℹ️Core idea: extract the traversal behavior of a collection into a separate Iterator object. The collection doesn't need to expose its internals; the iterator holds all traversal state (current position, how to advance).
Content is available with subscription.
Get full access to all courses on the platform for one year with a single payment.
Unlike other platforms that charge per course, here you get everything for one price, and after one year of use there will be no automatic charge for the following year.