org.xins.common.collections
Class EnumerationIterator

java.lang.Object
  extended byorg.xins.common.collections.EnumerationIterator
All Implemented Interfaces:
Iterator

public final class EnumerationIterator
extends Object
implements Iterator

Iterator implementation that reads from an Enumeration.

Since:
XINS 1.0.0
Version:
$Revision: 1.9 $ $Date: 2006/08/28 09:12:32 $
Author:
Ernst de Haan

Constructor Summary
EnumerationIterator(Enumeration enumeration)
          Constructs a new EnumerationIterator on top of the specified Enumeration.
 
Method Summary
 boolean hasNext()
          Checks if the iteration has more elements.
 Object next()
          Returns the next element in the iteration.
 void remove()
          Removes the last element returned by the iterator (unsupported operation).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EnumerationIterator

public EnumerationIterator(Enumeration enumeration)
                    throws IllegalArgumentException
Constructs a new EnumerationIterator on top of the specified Enumeration.

Parameters:
enumeration - the Enumeration object, cannot be null.
Throws:
IllegalArgumentException - if enumeration == null.
Method Detail

hasNext

public boolean hasNext()
Checks if the iteration has more elements.

Specified by:
hasNext in interface Iterator
Returns:
true if the iteration has more elements, false otherwise.

next

public Object next()
            throws NoSuchElementException
Returns the next element in the iteration.

Specified by:
next in interface Iterator
Returns:
the next element.
Throws:
NoSuchElementException - if the iteration has no more elements.

remove

public void remove()
            throws UnsupportedOperationException
Removes the last element returned by the iterator (unsupported operation).

The implementation of this method in class EnumerationIterator always throws an UnsupportedOperationException.

Specified by:
remove in interface Iterator
Throws:
UnsupportedOperationException - if this operation is not supported, which is the case for this implementation, so always.


See http://www.xins.org/.