E
- the type of elements held in this listpublic class DisposableWrapperList<E>
extends java.util.AbstractList<E>
ContainerUtil.createLockFreeCopyOnWriteList()
with additional methods that allow
some elements of the list to be associated with Disposable
objects. When these disposable objects are disposed,
the associated elements are removed from the list.Constructor and Description |
---|
DisposableWrapperList() |
Modifier and Type | Method and Description |
---|---|
boolean |
add(E element) |
Disposable |
add(E element,
Disposable parentDisposable)
Appends the specified element to the end of the list with automatic removal controlled by a given
Disposable . |
void |
add(int index,
E element) |
Disposable |
add(int index,
E element,
Disposable parentDisposable)
Inserts the specified element at the specified position in the list with automatic removal controlled by a given
Disposable . |
boolean |
addAll(java.util.Collection<? extends E> collection) |
boolean |
addAll(int index,
java.util.Collection<? extends E> collection) |
void |
clear() |
boolean |
contains(java.lang.Object obj) |
boolean |
containsAll(java.util.Collection<?> collection) |
E |
get(int index) |
int |
indexOf(java.lang.Object obj) |
boolean |
isEmpty() |
java.util.Iterator<E> |
iterator() |
int |
lastIndexOf(java.lang.Object obj) |
java.util.ListIterator<E> |
listIterator() |
java.util.ListIterator<E> |
listIterator(int index) |
E |
remove(int index) |
boolean |
remove(java.lang.Object obj) |
boolean |
removeAll(java.util.Collection<?> objects) |
boolean |
removeIf(java.util.function.Predicate<? super E> filter) |
boolean |
retainAll(java.util.Collection<?> objects) |
E |
set(int index,
E element) |
int |
size() |
java.util.List<E> |
subList(int fromIndex,
int toIndex) |
java.lang.Object [] |
toArray() |
<T> T [] |
toArray(T [] array) |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
public boolean add(E element)
public void add(int index, E element)
public Disposable add(E element, Disposable parentDisposable)
Disposable
.element
- element to be added to the listparentDisposable
- triggers removal of the element from the list when disposedpublic Disposable add(int index, E element, Disposable parentDisposable)
Disposable
.index
- index at which the specified element is to be insertedelement
- element to be inserted to the listparentDisposable
- triggers removal of the element from the list when disposedpublic boolean addAll(java.util.Collection<? extends E> collection)
public boolean addAll(int index, java.util.Collection<? extends E> collection)
public boolean remove(java.lang.Object obj)
public E remove(int index)
public boolean removeAll(java.util.Collection<?> objects)
public boolean removeIf(java.util.function.Predicate<? super E> filter)
public boolean retainAll(java.util.Collection<?> objects)
public void clear()
public int size()
public boolean isEmpty()
public java.util.Iterator<E> iterator()
public java.lang.Object [] toArray()
public <T> T [] toArray(T [] array)
public E get(int index)
public boolean contains(java.lang.Object obj)
public boolean containsAll(java.util.Collection<?> collection)
public int indexOf(java.lang.Object obj)
public int lastIndexOf(java.lang.Object obj)
public java.util.ListIterator<E> listIterator()
public java.util.ListIterator<E> listIterator(int index)