CopyOnWriteArrayList
CopyOnWriteArrayList
Implements following Interfaces
Implements following Interfaces
- Serializable,
- Cloneable
- Iterable<E>
- Collection<E>
- List<E>
- RandomAccess
- CopyOnWriteArrayList()
- CopyOnWriteArrayList(Collection<? extends E> c)
- CopyOnWriteArrayList(E[] toCopyIn)
Point to Remember
- Available in java.util.concurrent Package.
- Available since java 1.5.
- It is a thread safe variant of ArrayList.
- It perform all mutative operations (add, set etc) by making a copy of the underlying Array.
- Element changing operation (add, remove, set) are not allowed in iterator.
- It is useful when you dont want to synchrozine the traversal operation.
- It never changes during the lifetime of the Iterator.
- Iterator is guaranteed not to throw ConcurrentModificationException.
- It allows null.