Class EnumerationIterator<E>
java.lang.Object
org.apache.commons.collections4.iterators.EnumerationIterator<E>
- Type Parameters:
- E- the type of elements returned by this iterator.
- All Implemented Interfaces:
- Iterator<E>
Adapter to make 
Enumeration instances appear
 to be Iterator instances.- Since:
- 1.0
- 
Constructor SummaryConstructorsConstructorDescriptionConstructs a newEnumerationIteratorthat will not function untilsetEnumeration(Enumeration)is called.EnumerationIterator(Enumeration<? extends E> enumeration) Constructs a newEnumerationIteratorthat provides an iterator view of the given enumeration.EnumerationIterator(Enumeration<? extends E> enumeration, Collection<? super E> collection) Constructs a newEnumerationIteratorthat will remove elements from the specified collection.
- 
Method SummaryModifier and TypeMethodDescriptionEnumeration<? extends E> Gets the underlying enumeration.booleanhasNext()Returns true if the underlying enumeration has more elements.next()Returns the next object from the enumeration.voidremove()Removes the last retrieved element if a collection is attached.voidsetEnumeration(Enumeration<? extends E> enumeration) Sets the underlying enumeration.Methods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface java.util.IteratorforEachRemaining
- 
Constructor Details- 
EnumerationIteratorpublic EnumerationIterator()Constructs a newEnumerationIteratorthat will not function untilsetEnumeration(Enumeration)is called.
- 
EnumerationIteratorConstructs a newEnumerationIteratorthat provides an iterator view of the given enumeration.- Parameters:
- enumeration- the enumeration to use
 
- 
EnumerationIteratorConstructs a newEnumerationIteratorthat will remove elements from the specified collection.- Parameters:
- enumeration- the enumeration to use
- collection- the collection to remove elements from
 
 
- 
- 
Method Details- 
getEnumerationGets the underlying enumeration.- Returns:
- the underlying enumeration
 
- 
hasNextReturns true if the underlying enumeration has more elements.- Specified by:
- hasNextin interface- Iterator<E>
- Returns:
- true if the underlying enumeration has more elements
- Throws:
- NullPointerException- if the underlying enumeration is null
 
- 
next
- 
removeRemoves the last retrieved element if a collection is attached.Functions if an associated Collectionis known. If so, the first occurrence of the last returned object from this iterator will be removed from the collection.- Specified by:
- removein interface- Iterator<E>
- Throws:
- IllegalStateException-- next()not called.
- UnsupportedOperationException- if no associated collection
 
- 
setEnumerationSets the underlying enumeration.- Parameters:
- enumeration- the new underlying enumeration
 
 
-