org.apache.commons.collections.iterators
Class EnumerationIterator
java.lang.Object
org.apache.commons.collections.iterators.EnumerationIterator
- Iterator
public class EnumerationIterator
extends java.lang.Object
implements Iterator
Adapter to make Enumeration
instances appear
to be Iterator
instances.
$Revision: 1.8 $ $Date: 2004/04/21 20:34:12 $EnumerationIterator() - Constructs a new
EnumerationIterator that will not
function until setEnumeration(Enumeration) 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.
|
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
public EnumerationIterator()
EnumerationIterator
public EnumerationIterator(Enumeration enumeration)
Constructs a new EnumerationIterator
that provides
an iterator view of the given enumeration.
enumeration
- the enumeration to use
EnumerationIterator
public EnumerationIterator(Enumeration enumeration,
Collection collection)
Constructs a new EnumerationIterator
that will remove
elements from the specified collection.
enumeration
- the enumeration to usecollection
- the collection to remove elements form
getEnumeration
public Enumeration getEnumeration()
Returns the underlying enumeration.
- the underlying enumeration
hasNext
public boolean hasNext()
Returns true if the underlying enumeration has more elements.
- true if the underlying enumeration has more elements
next
public Object next()
Returns the next object from the enumeration.
- the next object from the enumeration
remove
public void remove()
Removes the last retrieved element if a collection is attached.
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.
setEnumeration
public void setEnumeration(Enumeration enumeration)
Sets the underlying enumeration.
enumeration
- the new underlying enumeration
Copyright © 2001-2006 Apache Software Foundation. All Rights Reserved.