Class SingletonIterator<E>
java.lang.Object
org.apache.commons.collections4.iterators.SingletonIterator<E>
- Type Parameters:
- E- the type of elements returned by this iterator.
- All Implemented Interfaces:
- Iterator<E>,- ResettableIterator<E>
SingletonIterator is an Iterator over a single
 object instance.- Since:
- 2.0
- 
Constructor SummaryConstructorsConstructorDescriptionSingletonIterator(E object) Constructs a newSingletonIteratorwhereremoveis a permitted operation.SingletonIterator(E object, boolean removeAllowed) Constructs a newSingletonIteratoroptionally choosing ifremoveis a permitted operation.
- 
Method SummaryMethods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface java.util.IteratorforEachRemaining
- 
Constructor Details- 
SingletonIteratorConstructs a newSingletonIteratorwhereremoveis a permitted operation.- Parameters:
- object- the single object to return from the iterator
 
- 
SingletonIteratorConstructs a newSingletonIteratoroptionally choosing ifremoveis a permitted operation.- Parameters:
- object- the single object to return from the iterator
- removeAllowed- true if remove is allowed
- Since:
- 3.1
 
 
- 
- 
Method Details- 
hasNext
- 
next
- 
removeRemove the object from this iterator.- Specified by:
- removein interface- Iterator<E>
- Throws:
- IllegalStateException- if the- nextmethod has not yet been called, or the- removemethod has already been called after the last call to the- nextmethod.
- UnsupportedOperationException- if remove is not supported
 
- 
resetReset the iterator to the start.- Specified by:
- resetin interface- ResettableIterator<E>
 
 
-