|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
An ListIterator is used to sequence over a List of objects. ListIterator can move backwards or forwards through the List.
| Method Summary | |
void |
add(java.lang.Object object)
Inserts the specified object into the list between next
and previous. |
boolean |
hasNext()
Answers if there are more elements to iterate. |
boolean |
hasPrevious()
Answers if there are previous elements to iterate. |
java.lang.Object |
next()
Answers the next object in the iteration. |
int |
nextIndex()
Answers the index of the next object in the iteration. |
java.lang.Object |
previous()
Answers the previous object in the iteration. |
int |
previousIndex()
Answers the index of the previous object in the iteration. |
void |
remove()
Removes the last object returned by next or
previous from the list. |
void |
set(java.lang.Object object)
Replaces the last object returned by next or
previous with the specified object. |
| Method Detail |
public void add(java.lang.Object object)
next
and previous. The object inserted will be the previous
object.
object - the object to insert
UnsupportedOperationException - when adding is not supported by the list being iterated
ClassCastException - when the class of the object is inappropriate for the list
IllegalArgumentException - when the object cannot be added to the listpublic boolean hasNext()
hasNext in interface Iteratornext()public boolean hasPrevious()
previous()public java.lang.Object next()
next in interface IteratorNoSuchElementException - when there are no more elementshasNext()public int nextIndex()
NoSuchElementException - when there are no more elementsnext()public java.lang.Object previous()
NoSuchElementException - when there are no previous elementshasPrevious()public int previousIndex()
NoSuchElementException - when there are no previous elementsprevious()public void remove()
next or
previous from the list.
remove in interface IteratorUnsupportedOperationException - when removing is not supported by the list being iterated
IllegalStateException - when next or previous have
not been called, or remove or
add have already been called after the last
call to next or previouspublic void set(java.lang.Object object)
next or
previous with the specified object.
object - the object to add
UnsupportedOperationException - when adding is not supported by the list being iterated
ClassCastException - when the class of the object is inappropriate for the list
IllegalArgumentException - when the object cannot be added to the list
IllegalStateException - when next or previous have
not been called, or remove or
add have already been called after the last
call to next or previous
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||