API Overview API Index Package Overview Direct link to this page
JDK 1.6
  java.util.concurrent. CopyOnWriteArrayList View Source
Author(s)
Doug Lea
Since
1.5
Version
Serial
Hierarchy
 Object
      CopyOnWriteArrayList
Implements
 List
 RandomAccess
 Cloneable
 Serializable
Subclasses
Description
public class CopyOnWriteArrayList
  A thread-safe variant of ArrayList in which all mutative operations (add, set, and so on) are implemented by making a fresh copy of the underlying array.
See also:   
Constructors
public CopyOnWriteArrayList ()
Creates an empty list.
public CopyOnWriteArrayList (Collection<Object> c)
  Creates a list containing the elements of the specified collection, in the order they are returned by the collection's iterator.
public CopyOnWriteArrayList ( E toCopyIn)
  Creates a list holding a copy of the given array.
Methods
Hide/Show inherited methods
public boolean add ( E e) [Specified in List]
  Appends the specified element to the end of this list.
public void add (int index, E element) [Specified in List]
  Inserts the specified element at the specified position in this list.
public boolean addAll (Collection<Object> c) [Specified in List]
  Appends all of the elements in the specified collection to the end of this list, in the order that they are returned by the specified collection's iterator.
public boolean addAll (int index, Collection<Object> c) [Specified in List]
  Inserts all of the elements in the specified collection into this list, starting at the specified position.
public int addAllAbsent (Collection<Object> c)
  Appends all of the elements in the specified collection that are not already contained in this list, to the end of this list, in the order that they are returned by the specified collection's iterator.
public boolean addIfAbsent ( E e)
  Append the element if not present.
public void clear () [Specified in List]
  Removes all of the elements from this list.
public Object clone ()
  Returns a shallow copy of this list.
public boolean contains (Object o) [Specified in List]
  Returns true if this list contains the specified element.
public boolean containsAll (Collection<Object> c) [Specified in List]
  Returns true if this list contains all of the elements of the specified collection.
public boolean equals (Object o) [Specified in List]
  Compares the specified object with this list for equality.
public E get (int index) [Specified in List]
  Returns the element at the specified position in this list.
pack-privatefinal Object getArray ()
  Gets the array.
public int hashCode () [Specified in List]
  Returns the hash code value for this list.
public int indexOf ( E e, int index)
  Returns the index of the first occurrence of the specified element in this list, searching forwards from index, or returns -1 if the element is not found.
public int indexOf (Object o) [Specified in List]
  Returns the index of the first occurrence of the specified element in this list, or -1 if this list does not contain the element.
public boolean isEmpty () [Specified in List]
  Returns true if this list contains no elements.
public Iterator< E> iterator () [Specified in List]
  Returns an iterator over the elements in this list in proper sequence.
public int lastIndexOf ( E e, int index)
  Returns the index of the last occurrence of the specified element in this list, searching backwards from index, or returns -1 if the element is not found.
public int lastIndexOf (Object o) [Specified in List]
  Returns the index of the last occurrence of the specified element in this list, or -1 if this list does not contain the element.
public ListIterator< E> listIterator () [Specified in List]
  Returns a list iterator over the elements in this list (in proper sequence).
public ListIterator< E> listIterator (int index) [Specified in List]
  Returns a list iterator of the elements in this list (in proper sequence), starting at the specified position in this list.
public E remove (int index) [Specified in List]
  Removes the element at the specified position in this list.
public boolean remove (Object o) [Specified in List]
  Removes the first occurrence of the specified element from this list, if it is present.
public boolean removeAll (Collection<Object> c) [Specified in List]
  Removes from this list all of its elements that are contained in the specified collection.
public boolean retainAll (Collection<Object> c) [Specified in List]
  Retains only the elements in this list that are contained in the specified collection.
public E set (int index, E element) [Specified in List]
  Replaces the element at the specified position in this list with the specified element.
pack-privatefinal void setArray (Object a)
Sets the array.
public int size () [Specified in List]
  Returns the number of elements in this list.
public List< E> subList (int fromIndex, int toIndex) [Specified in List]
  Returns a view of the portion of this list between fromIndex, inclusive, and toIndex, exclusive.
public Object toArray () [Specified in List]
  Returns an array containing all of the elements in this list in proper sequence (from first to last element).
public T toArray ( T a) [Specified in List]
  Returns an array containing all of the elements in this list in proper sequence (from first to last element); the runtime type of the returned array is that of the specified array.
public String toString ()
  Returns a string representation of this list.
Fields
Hide/Show inherited fields
pack-privatefinaltransient ReentrantLock lock
The lock protecting all mutators
Nested Classes
Generated By: JavaOnTracks Doclet 0.1.4     ©Thibaut Colar