⇒ Index (Frames) |  ⇒ Index (No Frames) |  ⇒ Package |  ⇒ Package Tree |  ⇒ Full Tree 
org.apache.commons.collections.iterators

Class IteratorEnumeration

java.lang.Object
|
+--org.apache.commons.collections.iterators.IteratorEnumeration

All Implemented Interfaces:
Enumeration


public class IteratorEnumeration
extends java.lang.Object
implements Enumeration

Adapter to make an Iterator Iterator instance appear to be an Enumeration Enumeration instance.
Since:
Commons Collections 1.0
Author:

Constructor Summary

IteratorEnumeration()

Constructs a new IteratorEnumeration that will not function until #setIterator(Iterator) setIterator is invoked.

IteratorEnumeration(Iterator iterator)

Constructs a new IteratorEnumeration that will use the given iterator.

Method Summary

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.

Constructor Details

IteratorEnumeration

public IteratorEnumeration()

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


IteratorEnumeration

public IteratorEnumeration(Iterator iterator)

Constructs a new IteratorEnumeration that will use the given iterator.

Parameters:
iterator - the iterator to use

Method Details

getIterator

public Iterator getIterator()

Returns the underlying iterator.

Returns:
the underlying iterator

hasMoreElements

public boolean hasMoreElements()

Returns true if the underlying iterator has more elements.

Returns:
true if the underlying iterator has more elements

nextElement

public Object nextElement()

Returns the next element from the underlying iterator.

Returns:
the next element from the underlying iterator.
Throws:
- if the underlying iterator has no more elements

setIterator

public void setIterator(Iterator iterator)

Sets the underlying iterator.

Parameters:
iterator - the new underlying iterator