java.util.concurrent
Class CopyOnWriteArrayList<E>
- Cloneable, Collection<E>, Iterable<E>, List<E>, RandomAccess, Serializable
CopyOnWriteArrayList() - Construct a new ArrayList with the default capacity (16).
|
CopyOnWriteArrayList(E> c) - Construct a new ArrayList, and initialize it with the elements in the
supplied Collection.
|
CopyOnWriteArrayList(E[] array) - Construct a new ArrayList, and initialize it with the elements in the
supplied array.
|
| T[] toArray(T[] a) - Returns an Array whose component type is the runtime component type of the
passed-in Array.
|
boolean | add(E e) - Appends the supplied element to the end of this list.
|
void | add(int index, E e) - Adds the supplied element at the specified index, shifting all elements
currently at that index or higher one to the right.
|
boolean | addAll(E> c) - Add each element in the supplied Collection to this List.
|
boolean | addAll(int index, E> c) - Add all elements in the supplied collection, inserting them beginning at
the specified index. c can contain objects of any type, as well as null
values.
|
int | addAllAbsent(E> c)
|
boolean | addIfAbsent(E val)
|
void | clear() - Removes all elements from this List
|
Object | clone() - Creates a shallow copy of this ArrayList (elements are not cloned).
|
boolean | contains(Object e) - Returns true iff element is in this ArrayList.
|
E | get(int index) - Retrieves the element at the user-supplied index.
|
int | indexOf(E e, int index) - Return the lowest index greater equal
index at which
e appears in this List, or -1 if it does not
appear.
|
int | indexOf(Object e) - Returns the lowest index at which element appears in this List, or -1 if it
does not appear.
|
boolean | isEmpty() - Checks if the list is empty.
|
int | lastIndexOf(E e, int index) - Returns the highest index lesser equal
index at
which e appears in this List, or -1 if it does not
appear.
|
int | lastIndexOf(Object e) - Returns the highest index at which element appears in this List, or -1 if
it does not appear.
|
E | remove(int index) - Removes the element at the user-supplied index.
|
E | set(int index, E e) - Sets the element at the specified index.
|
int | size() - Returns the number of elements in this list.
|
Object[] | toArray() - Returns an Object array containing all of the elements in this ArrayList.
|
add , add , addAll , clear , equals , get , hashCode , indexOf , iterator , lastIndexOf , listIterator , listIterator , remove , removeRange , set , subList |
T[] toArray , add , addAll , clear , contains , containsAll , isEmpty , iterator , remove , removeAll , retainAll , size , toArray , toString |
clone , equals , extends Object> getClass , finalize , hashCode , notify , notifyAll , toString , wait , wait , wait |
CopyOnWriteArrayList
public CopyOnWriteArrayList()
Construct a new ArrayList with the default capacity (16).
CopyOnWriteArrayList
public CopyOnWriteArrayList(E> c)
Construct a new ArrayList, and initialize it with the elements in the
supplied Collection. The initial capacity is 110% of the Collection's size.
c
- the collection whose elements will initialize this list
CopyOnWriteArrayList
public CopyOnWriteArrayList(E[] array)
Construct a new ArrayList, and initialize it with the elements in the
supplied array.
array
- the array used to initialize this list
T[] toArray
public T[] toArray(T[] a)
Returns an Array whose component type is the runtime component type of the
passed-in Array. The returned Array is populated with all of the elements
in this ArrayList. If the passed-in Array is not large enough to store all
of the elements in this List, a new Array will be created and returned; if
the passed-in Array is larger than the size of this List, then
size() index will be set to null.
- T[] toArray in interface List<E>
- T[] toArray in interface Collection<E>
- T[] toArray in interface AbstractCollection<E>
- an array representation of this list
add
public boolean add(E e)
Appends the supplied element to the end of this list. The element, e, can
be an object of any type or null.
- add in interface List<E>
- add in interface Collection<E>
- add in interface AbstractList<E>
e
- the element to be appended to this list
- true, the add will always succeed
add
public void add(int index,
E e)
Adds the supplied element at the specified index, shifting all elements
currently at that index or higher one to the right. The element, e, can be
an object of any type or null.
- add in interface List<E>
- add in interface AbstractList<E>
index
- the index at which the element is being addede
- the item being added
addAll
public boolean addAll(E> c)
Add each element in the supplied Collection to this List. It is undefined
what happens if you modify the list while this is taking place; for
example, if the collection contains this list. c can contain objects of any
type, as well as null values.
- addAll in interface List<E>
- addAll in interface Collection<E>
- addAll in interface AbstractCollection<E>
c
- a Collection containing elements to be added to this List
- true if the list was modified, in other words c is not empty
addAll
public boolean addAll(int index,
E> c)
Add all elements in the supplied collection, inserting them beginning at
the specified index. c can contain objects of any type, as well as null
values.
- addAll in interface List<E>
- addAll in interface AbstractList<E>
index
- the index at which the elements will be insertedc
- the Collection containing the elements to be inserted
clone
public Object clone()
Creates a shallow copy of this ArrayList (elements are not cloned).
- clone in interface Object
get
public E get(int index)
Retrieves the element at the user-supplied index.
- get in interface List<E>
- get in interface AbstractList<E>
index
- the index of the element we are fetching
indexOf
public int indexOf(E e,
int index)
Return the lowest index greater equal index
at which
e
appears in this List, or -1 if it does not
appear.
e
- the element whose inclusion in the list is being testedindex
- the index at which the search begins
- the index where
e
was found
indexOf
public int indexOf(Object e)
Returns the lowest index at which element appears in this List, or -1 if it
does not appear.
- indexOf in interface List<E>
- indexOf in interface AbstractList<E>
e
- the element whose inclusion in the List is being tested
- the index where e was found
lastIndexOf
public int lastIndexOf(E e,
int index)
Returns the highest index lesser equal index
at
which e
appears in this List, or -1 if it does not
appear.
e
- the element whose inclusion in the list is being testedindex
- the index at which the search begins
- the index where
e
was found
set
public E set(int index,
E e)
Sets the element at the specified index. The new element, e, can be an
object of any type or null.
- set in interface List<E>
- set in interface AbstractList<E>
index
- the index at which the element is being sete
- the element to be set
- the element previously at the specified index
CopyOnWriteArrayList.java
Copyright (C) 2006 Free Software Foundation
This file is part of GNU Classpath.
GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU Classpath; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA.
Linking this library statically or dynamically with other modules is
making a combined work based on this library. Thus, the terms and
conditions of the GNU General Public License cover the whole
combination.
As a special exception, the copyright holders of this library give you
permission to link this library with independent modules to produce an
executable, regardless of the license terms of these independent
modules, and to copy and distribute the resulting executable under
terms of your choice, provided that you also meet, for each linked
independent module, the terms and conditions of the license of that
module. An independent module is a module which is not derived from
or based on this library. If you modify this library, you may extend
this exception to your version of the library, but you are not
obligated to do so. If you do not wish to do so, delete this
exception statement from your version.