java.util
public
abstract
class
java.util.AbstractSequentialList<E>
AbstractSequentialList is an abstract implementation of the List interface.
This implementation does not support adding. A subclass must implement the
abstract method listIterator().
Known Direct Subclasses
LinkedList<E> |
LinkedList is an implementation of List, backed by a linked list. |
Summary
Protected Constructors
Public Methods
add,
add,
addAll,
clear,
equals,
get,
hashCode,
indexOf,
iterator,
lastIndexOf,
listIterator,
listIterator,
remove,
removeRange,
set,
subList
add,
addAll,
clear,
contains,
containsAll,
isEmpty,
iterator,
remove,
removeAll,
retainAll,
size,
toArray,
toArray,
toString
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait
add,
addAll,
clear,
contains,
containsAll,
equals,
hashCode,
isEmpty,
iterator,
remove,
removeAll,
retainAll,
size,
toArray,
toArray
Methods inherited
from interface
java.util.List
add,
add,
addAll,
addAll,
clear,
contains,
containsAll,
equals,
get,
hashCode,
indexOf,
isEmpty,
iterator,
lastIndexOf,
listIterator,
listIterator,
remove,
remove,
removeAll,
retainAll,
set,
size,
subList,
toArray,
toArray
Details
Protected Constructors
protected
AbstractSequentialList()
Constructs a new instance of this AbstractSequentialList.
Public Methods
public
void
add(int location, E object)
Inserts the specified object into this List at the specified location.
The object is inserted before any previous element at the specified
location. If the location is equal to the size of this List, the object
is added at the end.
Parameters
location
| the index at which to insert |
object
| the object to add |
public
boolean
addAll(int location, Collection<? extends E> collection)
Inserts the objects in the specified Collection at the specified location
in this List. The objects are added in the order they are returned from
the Collection iterator.
Parameters
location
| the index at which to insert |
collection
| the Collection of objects |
Returns
- true if this List is modified, false otherwise
public
E
get(int location)
Returns the element at the specified location in this List.
Parameters
location
| the index of the element to return |
Returns
- the element at the specified location
public
Iterator<E>
iterator()
Returns an Iterator on the elements of this List. The elements are
iterated in the same order that they occur in the List.
Returns
- an Iterator on the elements of this List
public
abstract
ListIterator<E>
listIterator(int location)
Returns a ListIterator on the elements of this List. The elements are
iterated in the same order that they occur in the List. The iteration
starts at the specified location.
Parameters
location
| the index at which to start the iteration |
Returns
- a ListIterator on the elements of this List
public
E
remove(int location)
Removes the object at the specified location from this List.
Parameters
location
| the index of the object to remove |
public
E
set(int location, E object)
Replaces the element at the specified location in this List with the
specified object.
Parameters
location
| the index at which to put the specified object |
object
| the object to add |
Returns
- the previous element at the index