E - the type of elements in the listpublic class SingletonListIterator<E> extends Object implements ListIterator<E>
| Constructor and Description | 
|---|
SingletonListIterator(SingletonList<E> list)
Constructor. 
 | 
| Modifier and Type | Method and Description | 
|---|---|
void | 
add(E o)
Set the unique element in the list. 
 | 
boolean | 
hasNext()
Return true if the iterator has just been created (the  
next() method has not been called). | 
boolean | 
hasPrevious()
Return false. 
 | 
E | 
next()
Return the only element in the list if the iterator has just been created (the  
next() method has not been called),
 or a NoSuchElementException else. | 
int | 
nextIndex()
Return 0 if the iterator has just been created (the  
next() method has not been called), or 1 else. | 
E | 
previous()
Return a  
NoSuchElementException. | 
int | 
previousIndex()
Return -1. 
 | 
void | 
remove()
Remove the unique element in the list. 
 | 
void | 
set(E o)
Replace the unique element in the list by the object. 
 | 
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitforEachRemainingpublic SingletonListIterator(SingletonList<E> list)
list - the SingletonListpublic boolean hasNext()
next() method has not been called).public E next()
next() method has not been called),
 or a NoSuchElementException else.public boolean hasPrevious()
hasPrevious in interface ListIterator<E>public E previous()
NoSuchElementException.previous in interface ListIterator<E>public int nextIndex()
next() method has not been called), or 1 else.nextIndex in interface ListIterator<E>public int previousIndex()
previousIndex in interface ListIterator<E>public void remove()
IllegalStateException if the list is not empty.public void set(E o)
IllegalStateException
 if the list is not empty.set in interface ListIterator<E>o - the objectpublic void add(E o)
IllegalStateException if the list is not empty.add in interface ListIterator<E>o - the object