| java.util.List<E> |
Known Indirect Subclasses
AbstractList<E>,
AbstractSequentialList<E>,
ArrayList<E>,
CopyOnWriteArrayList<E>,
LinkedList<E>,
Stack<E>,
Vector<E>
|
List is a collection which maintains an ordering for its elements. Every element in the list has an index.
| Public Methods | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
Inserts the specified object into this Vector at the specified location.
| |||||||||||
Adds the specified object at the end of this List.
| |||||||||||
Inserts the objects in the specified Collection at the specified location
in this List.
| |||||||||||
Adds the objects in the specified Collection to the end of this List.
| |||||||||||
Removes all elements from this List, leaving it empty.
| |||||||||||
Searches this List for the specified object.
| |||||||||||
Searches this List for all objects in the specified Collection.
| |||||||||||
Compares the argument to the receiver, and returns true if they represent
the same object using a class specific comparison.
| |||||||||||
Returns the element at the specified location in this List.
| |||||||||||
Returns an integer hash code for the receiver.
| |||||||||||
Searches this List for the specified object and returns the index of the
first occurrence.
| |||||||||||
Returns if this List has no elements, a size of zero.
| |||||||||||
Returns an Iterator on the elements of this List.
| |||||||||||
Searches this List for the specified object and returns the index of the
last occurrence.
| |||||||||||
Returns a ListIterator on the elements of this List.
| |||||||||||
Returns a ListIterator on the elements of this List.
| |||||||||||
Removes the object at the specified location from this List.
| |||||||||||
Removes the first occurrence of the specified object from this List.
| |||||||||||
Removes all occurrences in this List of each object in the specified
Collection.
| |||||||||||
Removes all objects from this List that are not contained in the
specified Collection.
| |||||||||||
Replaces the element at the specified location in this List with the
specified object.
| |||||||||||
Returns the number of elements in this List.
| |||||||||||
Returns a List of the specified portion of this List from the start index
to one less than the end index.
| |||||||||||
Returns an array containing all elements contained in this List.
| |||||||||||
Returns an array containing all elements contained in this List.
| |||||||||||
|
[Expand]
Inherited Methods | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
From interface java.lang.Iterable
| |||||||||||
From interface java.util.Collection
| |||||||||||
Inserts the specified object into this Vector 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.
| location | the index at which to insert |
|---|---|
| object | the object to add |
| UnsupportedOperationException | when adding to this List is not supported |
|---|---|
| ClassCastException | when the class of the object is inappropriate for this List |
| IllegalArgumentException | when the object cannot be added to this List |
| IndexOutOfBoundsException | when location < 0 || >= size()
|
Adds the specified object at the end of this List.
| object | the object to add |
|---|
| UnsupportedOperationException | when adding to this List is not supported |
|---|---|
| ClassCastException | when the class of the object is inappropriate for this List |
| IllegalArgumentException | when the object cannot be added to this List |
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.
| location | the index at which to insert |
|---|---|
| collection | the Collection of objects |
| UnsupportedOperationException | when adding to this List is not supported |
|---|---|
| ClassCastException | when the class of an object is inappropriate for this List |
| IllegalArgumentException | when an object cannot be added to this List |
| IndexOutOfBoundsException | when location < 0 || >= size()
|
Adds the objects in the specified Collection to the end of this List. The objects are added in the order they are returned from the Collection iterator.
| collection | the Collection of objects |
|---|
| UnsupportedOperationException | when adding to this List is not supported |
|---|---|
| ClassCastException | when the class of an object is inappropriate for this List |
| IllegalArgumentException | when an object cannot be added to this List |
Removes all elements from this List, leaving it empty.
| UnsupportedOperationException | when removing from this List is not supported |
|---|
Searches this List for the specified object.
| object | the object to search for |
|---|
Searches this List for all objects in the specified Collection.
| collection | the Collection of objects |
|---|
Compares the argument to the receiver, and returns true if they represent the same object using a class specific comparison.
| object | Object the object to compare with this object. |
|---|
true if the object is the same as this
object false if it is different from this object.Returns the element at the specified location in this List.
| location | the index of the element to return |
|---|
| IndexOutOfBoundsException | when location < 0 || >= size()
|
|---|
Returns an integer hash code for the receiver. Objects which are equal answer the same value for this method.
Searches this List for the specified object and returns the index of the first occurrence.
| object | the object to search for |
|---|
Returns if this List has no elements, a size of zero.
Returns an Iterator on the elements of this List. The elements are iterated in the same order that they occur in the List.
Searches this List for the specified object and returns the index of the last occurrence.
| object | the object to search for |
|---|
Returns a ListIterator on the elements of this List. The elements are iterated in the same order that they occur in the List.
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.
| location | the index at which to start the iteration |
|---|
| IndexOutOfBoundsException | when location < 0 || >= size() |
|---|
Removes the object at the specified location from this List.
| location | the index of the object to remove |
|---|
| UnsupportedOperationException | when removing from this List is not supported |
|---|---|
| IndexOutOfBoundsException | when location < 0 || >= size()
|
Removes the first occurrence of the specified object from this List.
| object | the object to remove |
|---|
| UnsupportedOperationException | when removing from this List is not supported |
|---|
Removes all occurrences in this List of each object in the specified Collection.
| collection | the Collection of objects to remove |
|---|
| UnsupportedOperationException | when removing from this List is not supported |
|---|
Removes all objects from this List that are not contained in the specified Collection.
| collection | the Collection of objects to retain |
|---|
| UnsupportedOperationException | when removing from this List is not supported |
|---|
Replaces the element at the specified location in this List with the specified object.
| location | the index at which to put the specified object |
|---|---|
| object | the object to add |
| UnsupportedOperationException | when replacing elements in this List is not supported |
|---|---|
| ClassCastException | when the class of an object is inappropriate for this List |
| IllegalArgumentException | when an object cannot be added to this List |
| IndexOutOfBoundsException | when location < 0 || >= size()
|
Returns the number of elements in this List.
Returns a List of the specified portion of this List from the start index to one less than the end index. The returned List is backed by this list so changes to one are reflected by the other.
| start | the index at which to start the sublist |
|---|---|
| end | the index one past the end of the sublist |
| IndexOutOfBoundsException | when start < 0, start > end or
end > size()
|
|---|
Returns an array containing all elements contained in this List. If the specified array is large enough to hold the elements, the specified array is used, otherwise an array of the same type is created. If the specified array is used and is larger than this List, the array element following the collection elements is set to null.
| array | the array |
|---|
| ArrayStoreException | when the type of an element in this List cannot be stored in the type of the specified array |
|---|
Returns an array containing all elements contained in this List.