public abstract class AbstractSequentialList<E> extends AbstractList<E>
This class is the opposite of the AbstractList class in the sense that it implements the "random access" methods (get(int index), set(int index, E element), add(int index, E element) and remove(int index)) on top of the list's list iterator, instead of the other way around.
To implement a list the programmer needs only to extend this class and provide implementations for the listIterator and size methods. For an unmodifiable list, the programmer need only implement the list iterator's hasNext, next, hasPrevious, previous and index methods.
For a modifiable list the programmer should additionally implement the list iterator's set method. For a variable-size list the programmer should additionally implement the list iterator's remove and add methods.
The programmer should generally provide a void (no argument) and collection constructor, as per the recommendation in the Collection interface specification.
This class is a member of the Java Collections Framework.
Collection
,
List
,
AbstractList
,
AbstractCollection
modCount
Modifier | Constructor | Description |
---|---|---|
protected |
AbstractSequentialList() |
Sole constructor.
|
Modifier and Type | Method | Description |
---|---|---|
void |
add(int index,
E element) |
Inserts the specified element at the specified position in this list
(optional operation).
|
boolean |
addAll(int index,
Collection<? extends |