Next | Tricks of the Wizards | 169 |
An iterator is an object interface to a list
Supports a `next' operation to generate the next item when it is needed
Why?
The list might be enormous
Might take a long time to come up with list elements
You don't know in advance how many you will want
You can pass the object around so it can be used by anyone who needs it
Next | Copyright © 2003 M. J. Dominus |