org.apache.commons.collections.iterators
Class SingletonListIterator
java.lang.Object
org.apache.commons.collections.iterators.SingletonListIterator
- Iterator, ListIterator, ResettableIterator, ResettableListIterator
public class SingletonListIterator
extends java.lang.Object
SingletonIterator
is an ListIterator
over a single
object instance.
Version:
- Stephen Colebourne
- Rodney Waldhoff
- Commons Collections 2.1
void | add(Object 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.
|
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
public SingletonListIterator(Object object)
Constructs a new SingletonListIterator
.
object
- the single object to return from the iterator
add
public void add(Object obj)
Add always throws UnsupportedOperationException
.
hasNext
public boolean hasNext()
Is another object available from the iterator?
This returns true if the single object hasn't been returned yet.
- true if the single object hasn't been returned yet
hasPrevious
public boolean hasPrevious()
Is a previous object available from the iterator?
This returns true if the single object has been returned.
- true if the single object has been returned
next
public Object next()
Get the next object from the iterator.
This returns the single object if it hasn't been returned yet.
- the single object
nextIndex
public int nextIndex()
Returns the index of the element that would be returned by a subsequent
call to next.
- 0 or 1 depending on current state.
previous
public Object previous()
Get the previous object from the iterator.
This returns the single object if it has been returned.
- the single object
previousIndex
public int previousIndex()
Returns the index of the element that would be returned by a subsequent
call to previous. A return value of -1 indicates that the iterator is currently at
the start.
- 0 or -1 depending on current state.
remove
public void remove()
Remove the object from this iterator.
set
public void set(Object obj)
Set sets the value of the singleton.
obj
- the object to set
Copyright © 2001-2005 Apache Software Foundation. All Rights Reserved.