com.darwinsys.util
Class EnumerationIterator

java.lang.Object
  extended bycom.darwinsys.util.EnumerationIterator
All Implemented Interfaces:
java.util.Iterator

public class EnumerationIterator
extends java.lang.Object
implements java.util.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.


Constructor Summary
EnumerationIterator(java.util.Enumeration old)
          Construct an EnumerationIterator from an old-style Enumeration.
 
Method Summary
 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.
 java.lang.Object next()
          Fulfuls the general contract of Iterator.next(), that is, returns the next element in the Iterator.
 void remove()
          Remove is not implemented (optional method).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EnumerationIterator

public EnumerationIterator(java.util.Enumeration old)
Construct an EnumerationIterator from an old-style Enumeration.

Parameters:
old - The Enumeration to be adapted.
Method Detail

hasNext

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.

Specified by:
hasNext in interface java.util.Iterator

next

public java.lang.Object next()
Fulfuls the general contract of Iterator.next(), that is, returns the next element in the Iterator.

Specified by:
next in interface java.util.Iterator

remove

public void remove()
Remove is not implemented (optional method).

Specified by:
remove in interface java.util.Iterator
Throws:
java.lang.UnsupportedOperationException - in all cases.


Copyright © 2000-2003 Ian F. Darwin. See license.html for usage license.