|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.commons.collections.collection.SynchronizedCollection<E> org.apache.commons.collections.list.SynchronizedList<E>
public class SynchronizedList<E>
Decorates another List
to synchronize its behaviour
for a multi-threaded environment.
Field Summary |
---|
Fields inherited from class org.apache.commons.collections.collection.SynchronizedCollection |
---|
collection, lock |
Constructor Summary | |
---|---|
protected |
SynchronizedList(List<E> list)
Constructor that wraps (not copies). |
protected |
SynchronizedList(List<E> list,
Object lock)
Constructor that wraps (not copies). |
Method Summary | ||
---|---|---|
void |
add(int index,
E object)
|
|
boolean |
addAll(int index,
Collection<? extends E> coll)
|
|
static
|
decorate(List<E> list)
Factory method to create a synchronized list. |
|
E |
get(int index)
|
|
protected List<E> |
getList()
Gets the decorated list. |
|
int |
indexOf(Object object)
|
|
int |
lastIndexOf(Object object)
|
|
ListIterator<E> |
listIterator()
Iterators must be manually synchronized. |
|
ListIterator<E> |
listIterator(int index)
Iterators must be manually synchronized. |
|
E |
remove(int index)
|
|
E |
set(int index,
E object)
|
|
List<E> |
subList(int fromIndex,
int toIndex)
|
Methods inherited from class org.apache.commons.collections.collection.SynchronizedCollection |
---|
add, addAll, clear, contains, containsAll, decorate, equals, hashCode, isEmpty, iterator, remove, removeAll, retainAll, size, toArray, toArray, toString |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Methods inherited from interface java.util.List |
---|
add, addAll, clear, contains, containsAll, equals, hashCode, isEmpty, iterator, remove, removeAll, retainAll, size, toArray, toArray |
Constructor Detail |
---|
protected SynchronizedList(List<E> list)
list
- the list to decorate, must not be null
IllegalArgumentException
- if list is nullprotected SynchronizedList(List<E> list, Object lock)
list
- the list to decorate, must not be nulllock
- the lock to use, must not be null
IllegalArgumentException
- if list is nullMethod Detail |
---|
public static <E> List<E> decorate(List<E> list)
list
- the list to decorate, must not be null
IllegalArgumentException
- if list is nullprotected List<E> getList()
public void add(int index, E object)
add
in interface List<E>
public boolean addAll(int index, Collection<? extends E> coll)
addAll
in interface List<E>
public E get(int index)
get
in interface List<E>
public int indexOf(Object object)
indexOf
in interface List<E>
public int lastIndexOf(Object object)
lastIndexOf
in interface List<E>
public ListIterator<E> listIterator()
synchronized (coll) { ListIterator it = coll.listIterator(); // do stuff with iterator }
listIterator
in interface List<E>
public ListIterator<E> listIterator(int index)
synchronized (coll) { ListIterator it = coll.listIterator(3); // do stuff with iterator }
listIterator
in interface List<E>
public E remove(int index)
remove
in interface List<E>
public E set(int index, E object)
set
in interface List<E>
public List<E> subList(int fromIndex, int toIndex)
subList
in interface List<E>
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |