org.jppf.utils
Class IteratorEnumeration<T>

java.lang.Object
  extended by org.jppf.utils.IteratorEnumeration<T>
Type Parameters:
T - the type of the enumerated objects.
All Implemented Interfaces:
Enumeration<T>

public class IteratorEnumeration<T>
extends Object
implements Enumeration<T>

Wraps an Iterator as an Enumeration


Constructor Summary
IteratorEnumeration(Iterator<T> iterator)
          Initialize this enumeration with the specified iterator.
 
Method Summary
 boolean hasMoreElements()
          Tests if this enumeration contains more elements.
 T nextElement()
          Returns the next element of this enumeration if this enumeration object has at least one more element to provide.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

IteratorEnumeration

public IteratorEnumeration(Iterator<T> iterator)
Initialize this enumeration with the specified iterator.

Parameters:
iterator - the iterator to wrap as an enumeration.
Method Detail

hasMoreElements

public boolean hasMoreElements()
Tests if this enumeration contains more elements.

Specified by:
hasMoreElements in interface Enumeration<T>
Returns:
true if and only if this enumeration object contains at least one more element to provide, false otherwise.
See Also:
Enumeration.hasMoreElements()

nextElement

public T nextElement()
Returns the next element of this enumeration if this enumeration object has at least one more element to provide.

Specified by:
nextElement in interface Enumeration<T>
Returns:
the next element of this enumeration.
Throws:
NoSuchElementException - if no more elements exist.
See Also:
Enumeration.nextElement()


Copyright © 2005-2010 JPPF Team.