Iterator< Computer Science Design Patterns
Provide a way to access the elements of an aggregate object sequentially without exposing its underlying representation.
In Java, the interface
java.util.Iterator<E> is an implementation of the iterator pattern. That way, all the objects that implement the
java.lang.Iterable<T> interface don't need a handy implementation of this pattern.
This pattern has a cost. Only implement this pattern for an important amount of code. IDE refactoring can't help you much.
This pattern has a cost to create.
This pattern is easy to maintain.
This pattern has a cost to remove too.
- Put the iterator term in the name of the iterator class to indicate the use of the pattern to the other developers.
- File handle objects implement this to provide line by line reading of their contents
- In Perl 5.12, arrays and tied arrays can be iterated over like hashes, with
- "New Class-Definition Syntax Introduced with MATLAB Software Version 7.6". The MathWorks, Inc. March 2009. http://www.mathworks.com/access/helpdesk/help/techdoc/matlab_oop/brqzfth-1.html#brqzfth-3. Retrieved September 22, 2009.