|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object net.sf.jga.util.SingletonIterator<T>
public class SingletonIterator<T>
Iterates over a single item. The iterator is structured as a list iterator, but the list is a fixed size (1). The value may be changed after it has been retrieved at least one time.
Constructor Summary | |
---|---|
SingletonIterator(T value)
Builds a SingletonIterator that will return the given value. |
Method Summary | |
---|---|
void |
add(T arg)
|
boolean |
hasNext()
Returns true if the item has not yet been returned. |
boolean |
hasPrevious()
Returns true if the item has not yet been returned. |
java.util.Iterator<T> |
iterator()
|
T |
next()
Returns the single item |
int |
nextIndex()
|
T |
previous()
Returns the single item |
int |
previousIndex()
|
void |
remove()
|
void |
set(T value)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public SingletonIterator(T value)
Method Detail |
---|
public java.util.Iterator<T> iterator()
iterator
in interface java.lang.Iterable<T>
public boolean hasNext()
hasNext
in interface java.util.Iterator<T>
hasNext
in interface java.util.ListIterator<T>
public T next()
next
in interface java.util.Iterator<T>
next
in interface java.util.ListIterator<T>
java.util.NoSuchElementException
- if the item has already been returnedpublic boolean hasPrevious()
hasPrevious
in interface java.util.ListIterator<T>
public T previous()
previous
in interface java.util.ListIterator<T>
java.util.NoSuchElementException
- if the item has already been returnedpublic int nextIndex()
nextIndex
in interface java.util.ListIterator<T>
public int previousIndex()
previousIndex
in interface java.util.ListIterator<T>
public void add(T arg)
add
in interface java.util.ListIterator<T>
public void set(T value)
set
in interface java.util.ListIterator<T>
public void remove()
remove
in interface java.util.Iterator<T>
remove
in interface java.util.ListIterator<T>
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |