EnumerationIteratorpublic class EnumerationIterator extends Object implements IteratorA 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 | oldEnumThe Enumeration being delegated to |
Constructors Summary |
---|
public EnumerationIterator(Enumeration old)Construct an EnumerationIterator from an old-style Enumeration.
oldEnum = old;
|
Methods Summary |
---|
public boolean | hasNext()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.Object | next()Fulfuls the general contract of Iterator.next(), that is,
returns the next element in the Iterator.
return oldEnum.nextElement();
| public void | remove()Remove is not implemented (optional method).
throw new UnsupportedOperationException("remove");
|
|