DthingApi
Public Member Functions | List of all members
java.util.ListIterator< E > Interface Template Reference
Inheritance diagram for java.util.ListIterator< E >:
java.util.Iterator< E >

Public Member Functions

void add (E object)
 
boolean hasNext ()
 
boolean hasPrevious ()
 
next ()
 
int nextIndex ()
 
previous ()
 
int previousIndex ()
 
void remove ()
 
void set (E object)
 

Detailed Description

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

Member Function Documentation

◆ add()

void java.util.ListIterator< E >.add ( object)

Inserts the specified object into the list between

and

. The object inserted will be the previous object.

Parameters
objectthe object to insert.
Exceptions
UnsupportedOperationExceptionif adding is not supported by the list being iterated.
ClassCastExceptionif the class of the object is inappropriate for the list.
IllegalArgumentExceptionif the object cannot be added to the list.

◆ hasNext()

boolean java.util.ListIterator< E >.hasNext ( )

Returns whether there are more elements to iterate.

Returns
true
if there are more elements,
false
otherwise.
See also
next

Implements java.util.Iterator< E >.

◆ hasPrevious()

boolean java.util.ListIterator< E >.hasPrevious ( )

Returns whether there are previous elements to iterate.

Returns
true
if there are previous elements,
false
otherwise.
See also
previous

◆ next()

E java.util.ListIterator< E >.next ( )

Returns the next object in the iteration.

Returns
the next object.
Exceptions
NoSuchElementExceptionif there are no more elements.
See also
hasNext

Implements java.util.Iterator< E >.

◆ nextIndex()

int java.util.ListIterator< E >.nextIndex ( )

Returns the index of the next object in the iteration.

Returns
the index of the next object, or the size of the list if the iterator is at the end.
Exceptions
NoSuchElementExceptionif there are no more elements.
See also
next

◆ previous()

E java.util.ListIterator< E >.previous ( )

Returns the previous object in the iteration.

Returns
the previous object.
Exceptions
NoSuchElementExceptionif there are no previous elements.
See also
hasPrevious

◆ previousIndex()

int java.util.ListIterator< E >.previousIndex ( )

Returns the index of the previous object in the iteration.

Returns
the index of the previous object, or -1 if the iterator is at the beginning.
Exceptions
NoSuchElementExceptionif there are no previous elements.
See also
previous

◆ remove()

void java.util.ListIterator< E >.remove ( )

Removes the last object returned by

or

from the list.

Exceptions
UnsupportedOperationExceptionif removing is not supported by the list being iterated.
IllegalStateExceptionif or have not been called, or
remove
or have already been called after the last call to or .

Implements java.util.Iterator< E >.

◆ set()

void java.util.ListIterator< E >.set ( object)

Replaces the last object returned by

or

with the specified object.

Parameters
objectthe object to set.
Exceptions
UnsupportedOperationExceptionif setting is not supported by the list being iterated
ClassCastExceptionif the class of the object is inappropriate for the list.
IllegalArgumentExceptionif the object cannot be added to the list.
IllegalStateExceptionif or have not been called, or
remove
or have already been called after the last call to or .

The documentation for this interface was generated from the following file: