org.xshare.base.iterator
Class EnumerationIterator

java.lang.Object
  |
  +--org.xshare.base.iterator.EnumerationIterator
All Implemented Interfaces:
java.util.Iterator

public class EnumerationIterator
extends java.lang.Object
implements java.util.Iterator

The EnumerationIterator wrapps a given Enumeration and adapts it to the Iterator interface.

Notes On The Implementation

  1. The remove() method is not supported, since the Enumeration does not provide the possibility to remove elements.

Version:
$Revision: 1.3 $
Author:
Oliver Fischer

Constructor Summary
EnumerationIterator(java.util.Enumeration pSource)
          Creates a new instance of this iterator, which adapts a given enumeration.
 
Method Summary
 boolean hasNext()
          Checks if there are elements of the underlying enumeration left to return or not.
 java.lang.Object next()
          Returns the next element of the underlying enumeration.
 void remove()
          This method is not supported, since the Enumeration doesn't offer the possiblity to remove objects.
 
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 pSource)
Creates a new instance of this iterator, which adapts a given enumeration.

Throws:
java.lang.NullPointerException - if null is passed to the constructor instead of a enumeration.
Method Detail

remove

public void remove()
This method is not supported, since the Enumeration doesn't offer the possiblity to remove objects.

Specified by:
remove in interface java.util.Iterator
Throws:
java.lang.UnsupportedOperationException - if this method is called.

next

public java.lang.Object next()
Returns the next element of the underlying enumeration.

Specified by:
next in interface java.util.Iterator
Throws:
NoSuchElementException - if there are no elements left to return. You can check this by calling hasNext().

hasNext

public boolean hasNext()
Checks if there are elements of the underlying enumeration left to return or not.

Specified by:
hasNext in interface java.util.Iterator
Returns:
a boolean value which is true if there are elements left.


jKiska Base 0.2.1 Release Esche [http://jkiska.sourceforge.net]