|
BRUtil - Making Java a Kinder, Gentler, Place to be. |
|||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
A uni-directional iterator that moves in the forward direction.
The ForwardListIterator contains a cursor that lies between elements
and that begins before the first element. Calls to
next return the element after the implicit cursor.
Current item is defined as the most recent element returned by
next. If none has been returned or the current item
has become undefined, then methods that require a current item will fail.
The methods remove and set require a
current item. The methods remove and insert
make the current item undefined.
The ListIterator does not support commodification, so any structural
modification of the list during the ListIterator's lifetime will result
in arbitrary behavior from all ListIterator Methods.
| Method Summary | |
java.lang.Object |
currentElement()
Returns the current element this Iterator points to, which is the value returned by the last call to next(). |
boolean |
hasNext()
Returns true if an element exists after the cursor. |
void |
insert(java.lang.Object elt)
The given element is inserted immediately before the cursor. |
java.lang.Object |
next()
Returns the element after the cursor and advances the cursor forwards. |
void |
remove()
Removes the current item from the list. |
java.lang.Object |
set(java.lang.Object elt)
Replaces the current item. |
| Method Detail |
public boolean hasNext()
true if an element exists after the cursor.
next will return the element.hasNext in interface java.util.Iteratortrue if an element exists after the cursor.public java.lang.Object next()
next in interface java.util.IteratorNoSuchElementException - if the cursor is after the last element.public java.lang.Object currentElement()
next(). Does not advance Iterator.NoSuchElementException - if the cursor is after the last element.public void remove()
remove in interface java.util.IteratorIllegalStateException - if current item is undefined.public java.lang.Object set(java.lang.Object elt)
elt - the element to replace the current item's element.IllegalStateException - if current item is undefined.public void insert(java.lang.Object elt)
next is unaffected.
If the list is empty, the new element becomes the sole element in
the list. Current item becomes undefined.elt - the element to be inserted.
|
BRUtil - Making Java a Kinder, Gentler, Place to be. |
|||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||