Contents
Page-10
Prev
Next
Page+10
Index
ListIterator
public interface ListIterator<AnyType>
extends Iterator<AnyType> {
boolean hasPrevious();
AnyType previous();
void add( AnyType x );
void set( AnyType newVal );
ListIterator extends the functionality of Iterator:
- It is possible to move backwards through the list as well as
forwards.
- add adds an element at the current position:
O(1) for LinkedList but O(n) for random positions in
ArrayList.
- set sets the value of the last item seen: O(1) for both.