FileDocCategorySizeDatePackage
ListIterator.javaAPI DocAndroid 1.5 API4866Wed May 06 22:41:04 BST 2009java.util

ListIterator

public interface ListIterator implements Iterator
An ListIterator is used to sequence over a List of objects. ListIterator can move backwards or forwards through the list.
since
Android 1.0

Fields Summary
Constructors Summary
Methods Summary
public voidadd(E object)
Inserts the specified object into the list between {@code next} and {@code previous}. The object inserted will be the previous object.

param
object the object to insert.
throws
UnsupportedOperationException if adding is not supported by the list being iterated.
throws
ClassCastException if the class of the object is inappropriate for the list.
throws
IllegalArgumentException if the object cannot be added to the list.
since
Android 1.0

public booleanhasNext()
Returns whether there are more elements to iterate.

return
{@code true} if there are more elements, {@code false} otherwise.
see
#next
since
Android 1.0

public booleanhasPrevious()
Returns whether there are previous elements to iterate.

return
{@code true} if there are previous elements, {@code false} otherwise.
see
#previous
since
Android 1.0

public Enext()
Returns the next object in the iteration.

return
the next object.
throws
NoSuchElementException if there are no more elements.
see
#hasNext
since
Android 1.0

public intnextIndex()
Returns the index of the next object in the iteration.

return
the index of the next object, or the size of the list if the iterator is at the end.
throws
NoSuchElementException if there are no more elements.
see
#next
since
Android 1.0

public Eprevious()
Returns the previous object in the iteration.

return
the previous object.
throws
NoSuchElementException if there are no previous elements.
see
#hasPrevious
since
Android 1.0

public intpreviousIndex()
Returns the index of the previous object in the iteration.

return
the index of the previous object, or -1 if the iterator is at the beginning.
throws
NoSuchElementException if there are no previous elements.
see
#previous
since
Android 1.0

public voidremove()
Removes the last object returned by {@code next} or {@code previous} from the list.

throws
UnsupportedOperationException if removing is not supported by the list being iterated.
throws
IllegalStateException if {@code next} or {@code previous} have not been called, or {@code remove} or {@code add} have already been called after the last call to {@code next} or {@code previous}.
since
Android 1.0

public voidset(E object)
Replaces the last object returned by {@code next} or {@code previous} with the specified object.

param
object the object to set.
throws
UnsupportedOperationException if setting is not supported by the list being iterated
throws
ClassCastException if the class of the object is inappropriate for the list.
throws
IllegalArgumentException if the object cannot be added to the list.
throws
IllegalStateException if {@code next} or {@code previous} have not been called, or {@code remove} or {@code add} have already been called after the last call to {@code next} or {@code previous}.
since
Android 1.0