|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.commons.collections.iterators.SingletonListIterator<E>
public class SingletonListIterator<E>
SingletonIterator
is an ListIterator
over a single
object instance.
Constructor Summary | |
---|---|
SingletonListIterator(E object)
Constructs a new SingletonListIterator . |
Method Summary | |
---|---|
void |
add(E obj)
Add always throws UnsupportedOperationException . |
boolean |
hasNext()
Is another object available from the iterator? This returns true if the single object hasn't been returned yet. |
boolean |
hasPrevious()
Is a previous object available from the iterator? This returns true if the single object has been returned. |
E |
next()
Get the next object from the iterator. |
int |
nextIndex()
Returns the index of the element that would be returned by a subsequent call to next. |
E |
previous()
Get the previous object from the iterator. |
int |
previousIndex()
Returns the index of the element that would be returned by a subsequent call to previous. |
void |
remove()
Remove the object from this iterator. |
void |
reset()
Reset the iterator back to the start. |
void |
set(E obj)
Set sets the value of the singleton. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public SingletonListIterator(E object)
SingletonListIterator
.
object
- the single object to return from the iteratorMethod Detail |
---|
public boolean hasNext()
hasNext
in interface Iterator<E>
hasNext
in interface ListIterator<E>
public boolean hasPrevious()
hasPrevious
in interface ListIterator<E>
public int nextIndex()
nextIndex
in interface ListIterator<E>
public int previousIndex()
previousIndex
in interface ListIterator<E>
public E next()
next
in interface Iterator<E>
next
in interface ListIterator<E>
NoSuchElementException
- if the single object has already
been returnedpublic E previous()
previous
in interface ListIterator<E>
NoSuchElementException
- if the single object has not already
been returnedpublic void remove()
remove
in interface Iterator<E>
remove
in interface ListIterator<E>
IllegalStateException
- if the next or previous
method has not yet been called, or the remove method
has already been called after the last call to next
or previous.public void add(E obj)
UnsupportedOperationException
.
add
in interface ListIterator<E>
UnsupportedOperationException
- alwayspublic void set(E obj)
set
in interface ListIterator<E>
obj
- the object to set
IllegalStateException
- if next has not been called
or the object has been removedpublic void reset()
reset
in interface ResettableIterator<E>
reset
in interface ResettableListIterator<E>
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |