| java.lang.Object | |
| ↳ | java.util.concurrent.CopyOnWriteArrayList<E> |
Implements a ArrayList variant that is thread-safe. All write operation result in a new copy of the underlying data being created. Iterators reflect the state of the CopyOnWriteArrayList at the time they were created. They are not updated to reflect subsequent changes to the list. In addition, these iterators cannot be used for modifying the underlying CopyOnWriteArrayList.
| Public Constructors | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
Creates a new, empty instance of CopyOnWriteArrayList.
| |||||||||||
Creates a new instance of CopyOnWriteArrayList and fills it with the
contents of a given Collection.
| |||||||||||
Creates a new instance of CopyOnWriteArrayList and fills it with the
contents of a given array.
| |||||||||||
| 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.
| |||||||||||
Adds to this CopyOnWriteArrayList all those elements from a given
collection that are not yet part of the list.
| |||||||||||
Adds to this CopyOnWriteArrayList another element, given that this
element is not yet part of the list.
| |||||||||||
Removes all elements from this List, leaving it empty.
| |||||||||||
Returns a new instance of the same class as the receiver, whose slots
have been filled in with the values in the slots of the receiver.
| |||||||||||
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.
| |||||||||||
Returns the index of a given element, starting the search from a given
position in the list.
| |||||||||||
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.
| |||||||||||
Returns the last index of a given element, starting the search from
a given position in the list and going backwards.
| |||||||||||
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.
| |||||||||||
Returns a string containing a concise, human-readable description of the
receiver.
| |||||||||||
|
[Expand]
Inherited Methods | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
From class java.lang.Object
| |||||||||||
From interface java.lang.Iterable
| |||||||||||
From interface java.util.Collection
| |||||||||||
From interface java.util.List
| |||||||||||
Creates a new, empty instance of CopyOnWriteArrayList.
Creates a new instance of CopyOnWriteArrayList and fills it with the contents of a given Collection.
| c | the collection the elements of which are to be copied into the new instance. |
|---|
Creates a new instance of CopyOnWriteArrayList and fills it with the contents of a given array.
| array | the array the elements of which are to be copied into the new instance. |
|---|
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.
| index | the index at which to insert |
|---|---|
| e | the object to add |
Adds the specified object at the end of this List.
| e | the object to add |
|---|
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.
| index | the index at which to insert |
|---|---|
| c | the Collection of objects |
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.
| c | the Collection of objects |
|---|
Adds to this CopyOnWriteArrayList all those elements from a given collection that are not yet part of the list.
| c | the collection from which the potential new elements are taken. |
|---|
Adds to this CopyOnWriteArrayList another element, given that this element is not yet part of the list.
| e | the potential new element. |
|---|
Removes all elements from this List, leaving it empty.
Returns a new instance of the same class as the receiver, whose slots have been filled in with the values in the slots of the receiver.
Classes which wish to support cloning must specify that they implement the Cloneable interface, since the implementation checks for this.
Searches this List for the specified object.
| o | the object to search for |
|---|
Searches this List for all objects in the specified Collection.
| c | the Collection of objects |
|---|
Compares the argument to the receiver, and returns true if they represent the same object using a class specific comparison. The implementation in Object returns true only if the argument is the exact same object as the receiver (==).
| o | 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.
| index | the index of the element to return |
|---|
Returns an integer hash code for the receiver. Any two objects which
answer true when passed to .equals must
answer the same value for this method.
Returns the index of a given element, starting the search from a given position in the list.
| e | the element to search. |
|---|---|
| index | the index at which to start the search. |
Searches this List for the specified object and returns the index of the first occurrence.
| o | 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.
Returns the last index of a given element, starting the search from a given position in the list and going backwards.
| e | the element to search. |
|---|---|
| index | the index at which to start the search. |
Searches this List for the specified object and returns the index of the last occurrence.
| o | 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.
| index | the index at which to start the iteration |
|---|
Removes the object at the specified location from this List.
| index | the index of the object to remove |
|---|
Removes the first occurrence of the specified object from this List.
| o | the object to remove |
|---|
Removes all occurrences in this List of each object in the specified Collection.
| c | the Collection of objects to remove |
|---|
Removes all objects from this List that are not contained in the specified Collection.
| c | the Collection of objects to retain |
|---|
Replaces the element at the specified location in this List with the specified object.
| index | the index at which to put the specified object |
|---|---|
| e | the object to add |
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.
| fromIndex | the index at which to start the sublist |
|---|---|
| toIndex | the index one past the end of the sublist |
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.
| a | the array |
|---|
Returns an array containing all elements contained in this List.
Returns a string containing a concise, human-readable description of the receiver.