org.apache.commons.collections.iterators

Class IteratorEnumeration

Implemented Interfaces:
Enumeration

public class IteratorEnumeration
extends java.lang.Object
implements Enumeration

Adapter to make an Iterator instance appear to be an Enumeration instance.
Version:
$Revision: 1.9 $ $Date: 2004/05/03 10:23:38 $
Author:
James Strachan
Since:
Commons Collections 1.0

Constructor Summary

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.

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()

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.

setIterator

public void setIterator(Iterator iterator)
Sets the underlying iterator.
Parameters:
iterator - the new underlying iterator

Copyright © 2001-2006 Apache Software Foundation. All Rights Reserved.