public class

IteratorEnumeration

extends Object
implements Enumeration<E>
java.lang.Object
   ↳ org.apache.commons.collections.iterators.IteratorEnumeration

Class Overview

Adapter to make an Iterator Iterator instance appear to be an Enumeration Enumeration instance.

Summary

Public Constructors
IteratorEnumeration()
Constructs a new IteratorEnumeration that will not function until setIterator is invoked.
IteratorEnumeration(Iterator iterator)
Constructs a new IteratorEnumeration that will use the given iterator.
Public Methods
Iterator getIterator()
Returns the underlying iterator.
boolean hasMoreElements()
Returns true if the underlying iterator has more elements.
Object nextElement()
Returns the next element from the underlying iterator.
void setIterator(Iterator iterator)
Sets the underlying iterator.
[Expand]
Inherited Methods
From class java.lang.Object
From interface java.util.Enumeration

Public Constructors

public IteratorEnumeration ()

Constructs a new IteratorEnumeration that will not function until setIterator is invoked.

public IteratorEnumeration (Iterator iterator)

Constructs a new IteratorEnumeration that will use the given iterator.

Parameters
iterator the iterator to use

Public Methods

public Iterator getIterator ()

Returns the underlying iterator.

Returns
  • the underlying iterator

public boolean hasMoreElements ()

Returns true if the underlying iterator has more elements.

Returns
  • true if the underlying iterator has more elements

public Object nextElement ()

Returns the next element from the underlying iterator.

Returns
  • the next element from the underlying iterator.
Throws
NoSuchElementException if the underlying iterator has no more elements

public void setIterator (Iterator iterator)

Sets the underlying iterator.

Parameters
iterator the new underlying iterator