com.Ostermiller.util Java Utilities


com.Ostermiller.util
Class EnumerationIterator<ElementType>

java.lang.Object
  extended by com.Ostermiller.util.EnumerationIterator<ElementType>
Type Parameters:
ElementType - type of object over which to iterate
All Implemented Interfaces:
Iterator<ElementType>

public class EnumerationIterator<ElementType>
extends Object
implements Iterator<ElementType>

Converts an Enumeration to an iterator.

More information about this class is available from ostermiller.org.

Since:
ostermillerutils 1.03.00
Author:
Stephen Ostermiller http://ostermiller.org/contact.pl?regarding=Java+Utilities

Constructor Summary
EnumerationIterator(Enumeration<ElementType> enumeration)
          Create an Iterator from an Enumeration.
 
Method Summary
 boolean hasNext()
          Tests if this Iterator contains more elements.
 ElementType next()
          Returns the next element of this Iterator if this Iterator object has at least one more element to provide.
 void remove()
          Operation not supported.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EnumerationIterator

public EnumerationIterator(Enumeration<ElementType> enumeration)
Create an Iterator from an Enumeration.

Parameters:
enumeration - Enumeration to convert to an Iterator.
Since:
ostermillerutils 1.03.00
Method Detail

hasNext

public boolean hasNext()
Tests if this Iterator contains more elements.

Specified by:
hasNext in interface Iterator<ElementType>
Returns:
true if and only if this Iterator object contains at least one more element to provide; false otherwise.
Since:
ostermillerutils 1.03.00

next

public ElementType next()
                 throws NoSuchElementException
Returns the next element of this Iterator if this Iterator object has at least one more element to provide.

Specified by:
next in interface Iterator<ElementType>
Returns:
the next element of this Iterator.
Throws:
NoSuchElementException - if no more elements exist.
Since:
ostermillerutils 1.03.00

remove

public void remove()
Operation not supported.

Specified by:
remove in interface Iterator<ElementType>
Throws:
UnsupportedOperationException - every time.
Since:
ostermillerutils 1.03.00

com.Ostermiller.util Java Utilities


Copyright © 2001-2012 by Stephen Ostermiller