Class EnumerationIterator
- java.lang.Object
-
- org.apache.commons.collections.iterators.EnumerationIterator
-
- All Implemented Interfaces:
java.util.Iterator
@Deprecated(since="2021-04-30") public class EnumerationIterator extends java.lang.Object implements java.util.Iterator
Deprecated.Commons Collections 3 is in maintenance mode. Commons Collections 4 should be used instead.Adapter to makeEnumeration
instances appear to beIterator
instances.- Since:
- Commons Collections 1.0
-
-
Constructor Summary
Constructors Constructor Description EnumerationIterator()
Deprecated.Constructs a newEnumerationIterator
that will not function untilsetEnumeration(Enumeration)
is called.EnumerationIterator(java.util.Enumeration enumeration)
Deprecated.Constructs a newEnumerationIterator
that provides an iterator view of the given enumeration.EnumerationIterator(java.util.Enumeration enumeration, java.util.Collection collection)
Deprecated.Constructs a newEnumerationIterator
that will remove elements from the specified collection.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description java.util.Enumeration
getEnumeration()
Deprecated.Returns the underlying enumeration.boolean
hasNext()
Deprecated.Returns true if the underlying enumeration has more elements.java.lang.Object
next()
Deprecated.Returns the next object from the enumeration.void
remove()
Deprecated.Removes the last retrieved element if a collection is attached.void
setEnumeration(java.util.Enumeration enumeration)
Deprecated.Sets the underlying enumeration.
-
-
-
Constructor Detail
-
EnumerationIterator
public EnumerationIterator()
Deprecated.Constructs a newEnumerationIterator
that will not function untilsetEnumeration(Enumeration)
is called.
-
EnumerationIterator
public EnumerationIterator(java.util.Enumeration enumeration)
Deprecated.Constructs a newEnumerationIterator
that provides an iterator view of the given enumeration.- Parameters:
enumeration
- the enumeration to use
-
EnumerationIterator
public EnumerationIterator(java.util.Enumeration enumeration, java.util.Collection collection)
Deprecated.Constructs a newEnumerationIterator
that will remove elements from the specified collection.- Parameters:
enumeration
- the enumeration to usecollection
- the collection to remove elements form
-
-
Method Detail
-
hasNext
public boolean hasNext()
Deprecated.Returns true if the underlying enumeration has more elements.- Specified by:
hasNext
in interfacejava.util.Iterator
- Returns:
- true if the underlying enumeration has more elements
- Throws:
java.lang.NullPointerException
- if the underlying enumeration is null
-
next
public java.lang.Object next()
Deprecated.Returns the next object from the enumeration.- Specified by:
next
in interfacejava.util.Iterator
- Returns:
- the next object from the enumeration
- Throws:
java.lang.NullPointerException
- if the enumeration is null
-
remove
public void remove()
Deprecated.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.- Specified by:
remove
in interfacejava.util.Iterator
- Throws:
java.lang.IllegalStateException
-next()
not called.java.lang.UnsupportedOperationException
- if no associated collection
-
getEnumeration
public java.util.Enumeration getEnumeration()
Deprecated.Returns the underlying enumeration.- Returns:
- the underlying enumeration
-
setEnumeration
public void setEnumeration(java.util.Enumeration enumeration)
Deprecated.Sets the underlying enumeration.- Parameters:
enumeration
- the new underlying enumeration
-
-