First page Back Continue Last page Overview Graphics
How Iterators Work
Iterators are implemented using a coroutine-like feature
When we call the iterator, a block of code is passed to the iterator method.
For each element in the collection, the iterator yields control back to the code block, passing the element via the code block’s parameter list.