org.apache.commons.collections.iterators
public class SingletonListIterator extends Object implements ListIterator, ResettableListIterator
SingletonIterator
is an ListIterator over a single
object instance.
Since: Commons Collections 2.1
Version: $Revision: 155406 $ $Date: 2005-02-26 12:55:26 +0000 (Sat, 26 Feb 2005) $
Constructor Summary | |
---|---|
SingletonListIterator(Object object)
Constructs a new SingletonListIterator .
|
Method Summary | |
---|---|
void | add(Object obj)
Add always throws UnsupportedOperationException.
|
boolean | hasNext()
Is another object available from the iterator?
|
boolean | hasPrevious()
Is a previous object available from the iterator?
|
Object | 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.
|
Object | 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(Object obj)
Set sets the value of the singleton.
|
SingletonListIterator
.
Parameters: object the single object to return from the iterator
Throws: UnsupportedOperationException always
This returns true if the single object hasn't been returned yet.
Returns: true if the single object hasn't been returned yet
This returns true if the single object has been returned.
Returns: true if the single object has been returned
This returns the single object if it hasn't been returned yet.
Returns: the single object
Throws: NoSuchElementException if the single object has already been returned
Returns: 0 or 1 depending on current state.
This returns the single object if it has been returned.
Returns: the single object
Throws: NoSuchElementException if the single object has not already been returned
Returns: 0 or -1 depending on current state.
Throws: 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.
Parameters: obj the object to set
Throws: IllegalStateException if next has not been called or the object has been removed