Class IteratorEnumeration<T>

java.lang.Object
org.jppf.utils.collections.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 Details

    • IteratorEnumeration

      public IteratorEnumeration(Iterator<T> iterator)
      Initialize this enumeration with the specified iterator.
      Parameters:
      iterator - the iterator to wrap as an enumeration.
  • Method Details

    • 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:
    • 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: