org.apache.commons.collections.iterators
public class EnumerationIterator extends Object implements Iterator
Enumeration Enumeration
instances appear
to be Iterator Iterator
instances.
Since: Commons Collections 1.0
Version: $Revision: 155406 $ $Date: 2005-02-26 12:55:26 +0000 (Sat, 26 Feb 2005) $
Constructor Summary | |
---|---|
EnumerationIterator()
Constructs a new EnumerationIterator that will not
function until setEnumeration is called. | |
EnumerationIterator(Enumeration enumeration)
Constructs a new EnumerationIterator that provides
an iterator view of the given enumeration.
| |
EnumerationIterator(Enumeration enumeration, Collection collection)
Constructs a new EnumerationIterator that will remove
elements from the specified collection.
|
Method Summary | |
---|---|
Enumeration | getEnumeration()
Returns the underlying enumeration.
|
boolean | hasNext()
Returns true if the underlying enumeration has more elements.
|
Object | next()
Returns the next object from the enumeration.
|
void | remove()
Removes the last retrieved element if a collection is attached.
|
void | setEnumeration(Enumeration enumeration)
Sets the underlying enumeration.
|
EnumerationIterator
that will not
function until setEnumeration is called.EnumerationIterator
that provides
an iterator view of the given enumeration.
Parameters: enumeration the enumeration to use
EnumerationIterator
that will remove
elements from the specified collection.
Parameters: enumeration the enumeration to use collection the collection to remove elements form
Returns: the underlying enumeration
Returns: true if the underlying enumeration has more elements
Throws: NullPointerException if the underlying enumeration is null
Returns: the next object from the enumeration
Throws: NullPointerException if the enumeration is null
Functions if an associated Collection
is known.
If so, the first occurrence of the last returned object from this
iterator will be removed from the collection.
Throws: IllegalStateException next()
not called. UnsupportedOperationException if no associated collection
Parameters: enumeration the new underlying enumeration