E - the element typepublic class CopyOnWriteArrayIdentityList<E> extends Object implements List<E>, RandomAccess, Cloneable, Serializable
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 CopyOnWriteArrayIdentityList 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
CopyOnWriteArrayIdentityList.
In addition, elements are compared based on reference equality instead of
object equality when comparing values.| Constructor and Description |
|---|
CopyOnWriteArrayIdentityList()
Creates a new, empty instance of CopyOnWriteArrayList.
|
CopyOnWriteArrayIdentityList(Collection<? extends E> c)
Creates a new instance of CopyOnWriteArrayList and fills it with the
contents of a given Collection.
|
CopyOnWriteArrayIdentityList(E[] array)
Creates a new instance of CopyOnWriteArrayList and fills it with the
contents of a given array.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
add(E e) |
void |
add(int index,
E e) |
boolean |
addAll(Collection<? extends E> c) |
boolean |
addAll(int index,
Collection<? extends E> c) |
int |
addAllAbsent(Collection<? extends E> c)
Adds to this CopyOnWriteArrayList all those elements from a given
collection that are not yet part of the list.
|
boolean |
addIfAbsent(E e)
Adds to this CopyOnWriteArrayList another element, given that this
element is not yet part of the list.
|
void |
clear() |
Object |
clone() |
boolean |
contains(Object o) |
boolean |
containsAll(Collection<?> c) |
boolean |
equals(Object o) |
E |
get(int index) |
int |
hashCode() |
int |
indexOf(E e,
int index)
Returns the index of a given element, starting the search from a given
position in the list.
|
int |
indexOf(Object o) |
boolean |
isEmpty() |
Iterator<E> |
iterator() |
int |
lastIndexOf(E e,
int index)
Returns the last index of a given element, starting the search from
a given position in the list and going backwards.
|
int |
lastIndexOf(Object o) |
ListIterator<E> |
listIterator() |
ListIterator<E> |
listIterator(int index) |
E |
remove(int index) |
boolean |
remove(Object o) |
boolean |
removeAll(Collection<?> c) |
boolean |
retainAll(Collection<?> c) |
E |
set(int index,
E e) |
int |
size() |
List<E> |
subList(int fromIndex,
int toIndex) |
Object[] |
toArray() |
<T> T[] |
toArray(T[] a) |
String |
toString() |
finalize, getClass, notify, notifyAll, wait, wait, waitreplaceAll, sort, spliteratorparallelStream, removeIf, streampublic CopyOnWriteArrayIdentityList()
public CopyOnWriteArrayIdentityList(Collection<? extends E> c)
c - the collection the elements of which are to be copied into
the new instance.public CopyOnWriteArrayIdentityList(E[] array)
array - the array the elements of which are to be copied into the
new instance.public boolean add(E e)
public boolean addAll(Collection<? extends E> c)
public boolean addAll(int index,
Collection<? extends E> c)
public int addAllAbsent(Collection<? extends E> c)
c - the collection from which the potential new elements are
taken.public boolean addIfAbsent(E e)
e - the potential new element.public void clear()
public boolean contains(Object o)
public boolean containsAll(Collection<?> c)
containsAll in interface Collection<E>containsAll in interface List<E>public boolean equals(Object o)
public int hashCode()
public int indexOf(E e, int index)
e - the element to search.index - the index at which to start the search.public boolean isEmpty()
public int lastIndexOf(E e, int index)
e - the element to search.index - the index at which to start the search.public int lastIndexOf(Object o)
lastIndexOf in interface List<E>public ListIterator<E> listIterator()
listIterator in interface List<E>public ListIterator<E> listIterator(int index)
listIterator in interface List<E>public boolean remove(Object o)
public boolean removeAll(Collection<?> c)
public boolean retainAll(Collection<?> c)
public int size()
public Object[] toArray()
public <T> T[] toArray(T[] a)
Copyright © 2007–2019 The Apache Software Foundation. All rights reserved.