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

EnumerationIterator

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
oldEnum
The Enumeration being delegated to
Constructors Summary
public EnumerationIterator(Enumeration old)
Construct an EnumerationIterator from an old-style Enumeration.

param
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 Iterator.next(), that is, returns the next element in the Iterator.

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

throws
java.lang.UnsupportedOperationException in all cases.

		throw new UnsupportedOperationException("remove");