加载中...
The Wayback Machine - https://sup1a9wrlpyh5li9ro.vcoronado.top/web/20090218034224/http://developer.android.com:80/reference/java/util/ListIterator.html
public interface

ListIterator

implements Iterator<E>
java.util.ListIterator<E>

Class Overview

An ListIterator is used to sequence over a List of objects. ListIterator can move backwards or forwards through the List.

Summary

Public Methods
abstract void add(E object)
Inserts the specified object into the list between next and previous.
abstract boolean hasNext()
Returns if there are more elements to iterate.
abstract boolean hasPrevious()
Returns if there are previous elements to iterate.
abstract E next()
Returns the next object in the iteration.
abstract int nextIndex()
Returns the index of the next object in the iteration.
abstract E previous()
Returns the previous object in the iteration.
abstract int previousIndex()
Returns the index of the previous object in the iteration.
abstract void remove()
Removes the last object returned by next or previous from the list.
abstract void set(E object)
Replaces the last object returned by next or previous with the specified object.
[Expand]
Inherited Methods
From interface java.util.Iterator

Public Methods

public abstract void add (E object)

Inserts the specified object into the list between next and previous. The object inserted will be the previous object.

Parameters
object the object to insert
Throws
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

public abstract boolean hasNext ()

Returns if there are more elements to iterate.

Returns
  • true if there are more elements, false otherwise
See Also

public abstract boolean hasPrevious ()

Returns if there are previous elements to iterate.

Returns
  • true if there are previous elements, false otherwise
See Also

public abstract E next ()

Returns the next object in the iteration.

Returns
  • the next object
Throws
NoSuchElementException when there are no more elements
See Also

public abstract int nextIndex ()

Returns the index of the next object in the iteration.

Returns
  • the index of the next object
Throws
NoSuchElementException when there are no more elements
See Also

public abstract E previous ()

Returns the previous object in the iteration.

Returns
  • the previous object
Throws
NoSuchElementException when there are no previous elements
See Also

public abstract int previousIndex ()

Returns the index of the previous object in the iteration.

Returns
  • the index of the previous object
Throws
NoSuchElementException when there are no previous elements
See Also

public abstract void remove ()

Removes the last object returned by next or previous from the list.

Throws
UnsupportedOperationException 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 previous

public abstract void set (E object)

Replaces the last object returned by next or previous with the specified object.

Parameters
object the object to add
Throws
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