Classes extended from AbstractList: VectorObject | --AbstractList
This class provides a skeletal implementation of the List interface to minimize the effort required to implement this interface backed by a "random access" data store (such as an array). For sequential access data (such as a linked list), AbstractSequentialList should be used in preference to this class. To implement an unmodifiable list, the programmer needs only to extend this class and provide implementations for the get(int index) and size() methods. To implement a modifiable list, the programmer must additionally override the set(int index, Object element) method (which otherwise throws an UnsupportedOperationException. If the list is variable-size the programmer must additionally override the add(int index, Object element) and remove(int index) methods. The programmer should generally provide a void (no argument) and collection constructor, as per the recommendation in the Collection interface specification. Unlike the other abstract collection implementations, the programmer does not have to provide an iterator implementation; the iterator and list iterator are implemented by this class, on top the "random access" methods: get(int index), set(int index, Object element), set(int index, Object element), add(int index, Object element) and remove(int index). The documentation for each non-abstract methods in this class describes its implementation in detail. Each of these methods may be overridden if the collection being implemented admits a more efficient implementation.
utilCollection, List, AbstractCollection$Revision: 0.1 $ $Date: 2003/05/01 12:00 PM $
@Japha 1.0
@Ryan Gantt
@void add()
boolean addAll()
boolean equals()
The get()
int indexOf()
ListIterator listIterator()
The remove()
void removeRange()
The set()
AbstractList subList()
void __construct()
Appends the specified element to the end of this List (optional operation).This implementation calls <tt>add(object, size())</tt>, if index is not specified.
Note that this implementation throws an <tt>UnsupportedOperationException</tt> unless <tt>add(int, Object)</tt> is overridden.
IndexOutOfBoundsException Index is out of range (index < 0 || index > size()).
@
public
IllegalArgumentException If some aspect of the specified element prevents it from being added to this list.
@
ClassCastException If the class of the specified element prevents it from being added to this list.
@
UnsupportedOperationException If the add method is not supported by this list.
@
Inserts the specified element at the specified position in this list (optional operation).
@
Inserts all of the elements in the specified collection into this list at the specified position (optional operation). Shifts the element currently at that position (if any) and any subsequent elements to the right (increases their indices). The new elements will appear in the list in the order that they are returned by the specified collection's iterator. The behavior of this operation is unspecified if the specified collection is modified while the operation is in progress. (Note that this will occur if the specified collection is this list, and it's nonempty.)This implementation gets an iterator over the specified collection and iterates over it, inserting the elements obtained from the iterator into this list at the appropriate position, one at a time, using <tt> add(int, Object)</tt>. Many implementations will override this method for efficiency.
Note that this implementation throws an <tt>UnsupportedOperationException</tt> unless <tt>add(int, Object)</tt> is overridden.
<tt>true</tt> if this list changed as a result of the call.
@
public
NullPointerException If the specified collection is null.
@
IndexOutOfBoundsException Index out of range (index < 0 || index > size()).
@
ClassCastException If the class of an element of the specified collection prevents it from being added to this List.
@
IllegalArgumentException Some aspect an element of the specified collection prevents it from being added to this List.
@
UnsupportedOperationException If the addAll method is not supported by this list.
@
Overrides: Object::equals()
Compares the specified object with this list for equality. Returns <tt>true</tt> if and only if the specified object is also a list, both lists have the same size, and all corresponding pairs of elements in the two lists are equal. (Two elements <tt>e1</tt> and <tt>e2</tt> are equal if <tt>(e1==null ? e2==null : e1.equals(e2))</tt>.) In other words, two lists are defined to be equal if they contain the same elements in the same order.This implementation first checks if the specified object is this list. If so, it returns <tt>true</tt>; if not, it checks if the specified object is a list. If not, it returns <tt>false</tt>; if so, it iterates over both lists, comparing corresponding pairs of elements. If any comparison returns <tt>false</tt>, this method returns <tt>false</tt>. If either iterator runs out of elements before the other it returns <tt>false</tt> (as the lists are of unequal length); otherwise it returns <tt>true</tt> when the iterations complete.
<tt>true</tt> if the specified object is equal to this list.
@
public
Returns the element at the specified position in this list.
element at the specified position in this list.
@
public
IndexOutOfBoundsException if the given index is out of range (index < 0 || index >= size()).
@
Returns the index in this list of the first occurence of the specified element, or -1 if the list does not contain this element. More formally, returns the lowest index <tt>i</tt> such that <tt>(o==null ? get(i)==null : o.equals(get(i)))</tt>, or -1 if there is no such index.This implementation first gets a list iterator (with <tt>listIterator()</tt>). Then, it iterates over the list until the specified element is found or the end of the list is reached.
The index in this List of the first occurence of the specified element, or -1 if the List does not contain this element.
@
public
Returns a list iterator of the elements in this list (in proper sequence), starting at the specified position in the list. The specified index indicates the first element that would be returned by an initial call to the <tt>next</tt> method. An initial call to the <tt>previous</tt> method would return the element with the specified index minus one.This implementation returns a straightforward implementation of the <tt>ListIterator</tt> interface that extends the implementation of the <tt>Iterator</tt> interface returned by the <tt>iterator()</tt> method. The <tt>ListIterator</tt> implementation relies on the backing list's <tt>get(int)</tt>, <tt>set(int, Object)</tt>, <tt>add(int, Object)</tt> and <tt>remove(int)</tt> methods.
Note that the list iterator returned by this implementation will throw an <tt>UnsupportedOperationException</tt> in response to its <tt>remove</tt>, <tt>set</tt> and <tt>add</tt> methods unless the list's <tt>remove(int)</tt>, <tt>set(int, Object)</tt>, and <tt>add(int, Object)</tt> methods are overridden.
This implementation can be made to throw runtime exceptions in the face of concurrent modification, as described in the specification for the (protected) <tt>modCount</tt> field.
an iterator of the elements in this list (in proper sequence).
@
public
IndexOutOfBoundsException If the specified index is out of range (index < 0 || index > size()).
@
Removes the element at the specified position in this list (optional operation). Shifts any subsequent elements to the left (subtracts one from their indices). Returns the element that was removed from the list.This implementation always throws an <tt>UnsupportedOperationException</tt>.
element previously at the specified position.
@
public
IndexOutOfBoundsException If the specified index is out of range (index < 0 || index >= size()).
@
UnsupportedOperationException If the remove method is not supported by this list.
@
Removes from this list all of the elements whose index is between <tt>fromIndex</tt>, inclusive, and <tt>toIndex</tt>, exclusive. Shifts any succeeding elements to the left (reduces their index). This call shortens the ArrayList by <tt>(toIndex - fromIndex)</tt> elements. (If <tt>toIndex==fromIndex</tt>, this operation has no effect.)This method is called by the <tt>clear</tt> operation on this list and its subLists. Overriding this method to take advantage of the internals of the list implementation can substantially improve the performance of the <tt>clear</tt> operation on this list and its subLists.
This implementation gets a list iterator positioned before <tt>fromIndex</tt>, and repeatedly calls <tt>ListIterator.next</tt> followed by <tt>ListIterator.remove</tt> until the entire range has been removed. Note: if <tt>ListIterator.remove</tt> requires linear time, this implementation requires quadratic time.
IndexOutOfBoundsException If the to or from parameters are larger than the array
public
Replaces the element at the specified position in this list with the specified element (optional operation).This implementation always throws an <tt>UnsupportedOperationException</tt>.
element previously at the specified position.
@
IndexOutOfBoundsException If the specified index is out of range (index < 0 || index >= size()).
IllegalArgumentException If some aspect of the specified element prevents it from being added to this list.
@
ClassCastException If the class of the specified element prevents it from being added to this list.
@
UnsupportedOperationException If the set method is not supported by this List.
@
public
Returns a view of the portion of this list between <tt>fromIndex</tt>, inclusive, and <tt>toIndex</tt>, exclusive. (If <tt>fromIndex</tt> and <tt>toIndex</tt> are equal, the returned list is empty.) The returned list is backed by this list, so changes in the returned list are reflected in this list, and vice-versa. The returned list supports all of the optional list operations supported by this list.This method eliminates the need for explicit range operations (of the sort that commonly exist for arrays). Any operation that expects a list can be used as a range operation by operating on a subList view instead of a whole list. For example, the following idiom removes a range of elements from a list:
list.subList(from, to).clear();Similar idioms may be constructed for <tt>indexOf</tt> and <tt>lastIndexOf</tt>, and all of the algorithms in the <tt>Collections</tt> class can be applied to a subList.The semantics of the list returned by this method become undefined if the backing list (i.e., this list) is structurally modified in any way other than via the returned list. (Structural modifications are those that change the size of the list, or otherwise perturb it in such a fashion that iterations in progress may yield incorrect results.)
This implementation returns a list that subclasses <tt>AbstractList</tt>. The subclass stores, in private fields, the offset of the subList within the backing list, the size of the subList (which can change over its lifetime), and the expected <tt>modCount</tt> value of the backing list. There are two variants of the subclass, one of which implements <tt>RandomAccess</tt>. If this list implements <tt>RandomAccess</tt> the returned list will be an instance of the subclass that implements <tt>RandomAccess</tt>.
The subclass's <tt>set(int, Object)</tt>, <tt>get(int)</tt>, <tt>add(int, Object)</tt>, <tt>remove(int)</tt>, <tt>addAll(int, Collection)</tt> and <tt>removeRange(int, int)</tt> methods all delegate to the corresponding methods on the backing abstract list, after bounds-checking the index and adjusting for the offset. The <tt>addAll(Collection c)</tt> method merely returns <tt>addAll(size, c)</tt>.
The <tt>listIterator(int)</tt> method returns a "wrapper object" over a list iterator on the backing list, which is created with the corresponding method on the backing list. The <tt>iterator</tt> method merely returns <tt>listIterator()</tt>, and the <tt>size</tt> method merely returns the subclass's <tt>size</tt> field.
All methods first check to see if the actual <tt>modCount</tt> of the backing list is equal to its expected value, and throw a <tt>ConcurrentModificationException</tt> if it is not.
a view of the specified range within this list.
@
IllegalArgumentException Endpoint indices out of order (fromIndex > toIndex)
IndexOutOfBoundsException Endpoint index value out of range (fromIndex < 0 || toIndex > size)
@
@
public
Unified constructor. Takes no parameters. Makes a new list, and sets the mod count to zero.
Creates a new list and populates it with... nothing.