EnumerationIterator.javaAPI DocExample1210Mon May 31 22:51:38 BST 2004com.darwinsys.util


public class EnumerationIterator extends Object implements Iterator
A GOF Adapter to make instances of old Enumeration interface behave like new Iterator interface, so we only have to deal with one well-defined implementation of the Iterator pattern.

Fields Summary
private final Enumeration
The Enumeration being delegated to
Constructors Summary
public EnumerationIterator(Enumeration old)
Construct an EnumerationIterator from an old-style Enumeration.

old The Enumeration to be adapted.

		oldEnum = old;
Methods Summary
public booleanhasNext()
Fulfuls the general contract of Iterator.hasNext(), that is, return true as long as there is at least one more item in the Iterator.

		return oldEnum.hasMoreElements();
public java.lang.Objectnext()
Fulfuls the general contract of, that is, returns the next element in the Iterator.

		return oldEnum.nextElement();
public voidremove()
Remove is not implemented (optional method).

java.lang.UnsupportedOperationException in all cases.

		throw new UnsupportedOperationException("remove");