Package hudson.util
Class CopyOnWriteList<E>
- java.lang.Object
-
- hudson.util.CopyOnWriteList<E>
-
- All Implemented Interfaces:
Iterable<E>
public class CopyOnWriteList<E> extends Object implements Iterable<E>
List-like implementation that has copy-on-write semantics.This class is suitable where highly concurrent access is needed, yet the write operation is relatively uncommon.
- Author:
- Kohsuke Kawaguchi
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classCopyOnWriteList.ConverterImplConverterimplementation for XStream.
-
Constructor Summary
Constructors Constructor Description CopyOnWriteList()CopyOnWriteList(List<E> core)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidadd(E e)voidaddAll(Collection<? extends E> items)voidaddAllTo(Collection<? super E> dst)voidclear()booleancontains(Object item)Eget(int index)List<E>getView()booleanisEmpty()Iterator<E>iterator()Returns an iterator.booleanremove(E e)Removes an item from the list.voidreplaceBy(E... that)Completely replaces this list by the contents of the given list.voidreplaceBy(CopyOnWriteList<? extends E> that)Completely replaces this list by the contents of the given list.voidreplaceBy(Collection<? extends E> that)Completely replaces this list by the contents of the given list.intsize()<T> T[]toArray(T[] array)StringtoString()-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
-
-
-
Method Detail
-
add
public void add(E e)
-
addAll
public void addAll(Collection<? extends E> items)
-
remove
public boolean remove(E e)
Removes an item from the list.- Returns:
- true if the list contained the item. False if it didn't, in which case there's no change.
-
replaceBy
public void replaceBy(CopyOnWriteList<? extends E> that)
Completely replaces this list by the contents of the given list.
-
replaceBy
public void replaceBy(Collection<? extends E> that)
Completely replaces this list by the contents of the given list.
-
replaceBy
public void replaceBy(E... that)
Completely replaces this list by the contents of the given list.
-
clear
public void clear()
-
toArray
public <T> T[] toArray(T[] array)
-
addAllTo
public void addAllTo(Collection<? super E> dst)
-
get
public E get(int index)
-
isEmpty
public boolean isEmpty()
-
size
public int size()
-
contains
public boolean contains(Object item)
-
-