The Iterator pattern enables client code to read a collection's data without exposing the structure of the data or making the data inadvertently writable. The Iterator pattern is a common pattern that provides a standard interface for reading collection data. Although the Iterator pattern is simple, it is very useful. In fact, it is the pattern's simplicity that makes it so useful. Because the pattern standardizes the way to access data from collections, it allows you to create interfaces that interact with the IIterator interface rather than with any specific implementation. That means that your code is more flexible and adaptable. |