public class SingletonListIterator
extends java.lang.Object
implements java.util.ListIterator
SingletonIterator
is an ListIterator
over a single
object instance.
Constructor and Description |
---|
SingletonListIterator(java.lang.Object object)
Constructs a new
SingletonListIterator . |
Modifier and Type | Method and Description |
---|---|
void |
add(java.lang.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.
|
java.lang.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.
|
java.lang.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 always throws
UnsupportedOperationException . |
void |
set(java.lang.Object obj)
Set sets the value of the singleton.
|
public SingletonListIterator(java.lang.Object object)
SingletonListIterator
.object
- the single object to return from the iteratorpublic void add(java.lang.Object obj)
UnsupportedOperationException
.add
in interface java.util.ListIterator
java.lang.UnsupportedOperationException
- alwayspublic boolean hasNext()
This returns true if the single object hasn't been returned yet.
hasNext
in interface java.util.Iterator
hasNext
in interface java.util.ListIterator
public boolean hasPrevious()
This returns true if the single object has been returned.
hasPrevious
in interface java.util.ListIterator
public java.lang.Object next()
This returns the single object if it hasn't been returned yet.
next
in interface java.util.Iterator
next
in interface java.util.ListIterator
java.util.NoSuchElementException
- if the single object has already
been returnedpublic int nextIndex()
nextIndex
in interface java.util.ListIterator
public java.lang.Object previous()
This returns the single object if it has been returned.
previous
in interface java.util.ListIterator
java.util.NoSuchElementException
- if the single object has not already
been returnedpublic int previousIndex()
previousIndex
in interface java.util.ListIterator
public void remove()
UnsupportedOperationException
.remove
in interface java.util.Iterator
remove
in interface java.util.ListIterator
java.lang.UnsupportedOperationException
- alwayspublic void set(java.lang.Object obj)
set
in interface java.util.ListIterator
obj
- the object to setjava.lang.IllegalStateException
- if next has not been calledCopyright © 2001-2004 Apache Software Foundation. Documenation generated April 29 2013.