java.lang.Objectjava.util.AbstractCollection
java.util.AbstractList
java.util.AbstractSequentialList
All Implemented Interfaces:
List, Collection
Direct Known Subclasses:
LinkedList
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.
Josh - BlochNeal - Gafter1.2 - | Fields inherited from java.util.AbstractList: |
|---|
| modCount |
| Constructor: |
|---|
|
| Method from java.util.AbstractSequentialList Summary: |
|---|
| add, addAll, get, iterator, listIterator, remove, set |
| Methods from java.util.AbstractList: |
|---|
| add, add, addAll, clear, equals, get, hashCode, indexOf, iterator, lastIndexOf, listIterator, listIterator, remove, removeRange, set, subList |
| Methods from java.util.AbstractCollection: |
|---|
| add, addAll, clear, contains, containsAll, isEmpty, iterator, remove, removeAll, retainAll, size, toArray, toArray, toString |
| Methods from java.lang.Object: |
|---|
| clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method from java.util.AbstractSequentialList Detail: |
|---|
This implementation first gets a list iterator pointing to the indexed element (with listIterator(index)). Then, it inserts the specified element with ListIterator.add. Note that this implementation will throw an UnsupportedOperationException if the list iterator does not implement the add operation. |
This implementation gets an iterator over the specified collection and a list iterator over this list pointing to the indexed element (with listIterator(index)). Then, it iterates over the specified collection, inserting the elements obtained from the iterator into this list, one at a time, using ListIterator.add followed by ListIterator.next (to skip over the added element). Note that this implementation will throw an UnsupportedOperationException if the list iterator returned by the listIterator method does not implement the add operation. |
This implementation first gets a list iterator pointing to the indexed element (with listIterator(index)). Then, it gets the element using ListIterator.next and returns it. |
This implementation merely returns a list iterator over the list. |
|
This implementation first gets a list iterator pointing to the indexed element (with listIterator(index)). Then, it removes the element with ListIterator.remove. Note that this implementation will throw an UnsupportedOperationException if the list iterator does not implement the remove operation. |
This implementation first gets a list iterator pointing to the indexed element (with listIterator(index)). Then, it gets the current element using ListIterator.next and replaces it with ListIterator.set. Note that this implementation will throw an UnsupportedOperationException if the list iterator does not implement the set operation. |