|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.commons.collections.iterators.SingletonIterator
public class SingletonIterator
SingletonIterator
is an Iterator
over a single
object instance.
Constructor Summary | |
---|---|
SingletonIterator(java.lang.Object object)
Constructs a new SingletonIterator where remove
is a permitted operation. |
|
SingletonIterator(java.lang.Object object,
boolean removeAllowed)
Constructs a new SingletonIterator optionally choosing if
remove is a permitted operation. |
Method Summary | |
---|---|
boolean |
hasNext()
Is another object available from the iterator? |
java.lang.Object |
next()
Get the next object from the iterator. |
void |
remove()
Remove the object from this iterator. |
void |
reset()
Reset the iterator to the start. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public SingletonIterator(java.lang.Object object)
SingletonIterator
where remove
is a permitted operation.
object
- the single object to return from the iteratorpublic SingletonIterator(java.lang.Object object, boolean removeAllowed)
SingletonIterator
optionally choosing if
remove
is a permitted operation.
object
- the single object to return from the iteratorremoveAllowed
- true if remove is allowedMethod Detail |
---|
public boolean hasNext()
This returns true if the single object hasn't been returned yet.
hasNext
in interface java.util.Iterator
public java.lang.Object next()
This returns the single object if it hasn't been returned yet.
next
in interface java.util.Iterator
java.util.NoSuchElementException
- if the single object has already
been returnedpublic void remove()
remove
in interface java.util.Iterator
java.lang.IllegalStateException
- if the next method has not
yet been called, or the remove method has already
been called after the last call to the next
method.
java.lang.UnsupportedOperationException
- if remove is not supportedpublic void reset()
reset
in interface ResettableIterator
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |