The Iterator is one of the simplest and most frequently used of the design patterns. The Iterator pattern allows you to move through a list or collection of data using a standard interface without having to know the details of the internal representations of that data. Ex. Enumerator
Example :
public interface Iterator
{
public Object First();
public Object Next();
public boolean isDone();
public Object CurrentItem();
}
public interface Enumeration
{
public boolean hasMoreElements();
public Object nextElement();
}
No comments:
Post a Comment