|
||||||||||
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 org.apache.commons.collections.list.SynchronizedList
public class SynchronizedList
Decorates another List
to synchronize its behaviour
for a multi-threaded environment.
Methods are synchronized, then forwarded to the decorated list.
This class is Serializable from Commons Collections 3.1.
Field Summary |
---|
Fields inherited from class org.apache.commons.collections.collection.SynchronizedCollection |
---|
collection, lock |
Constructor Summary | |
---|---|
protected |
SynchronizedList(java.util.List list)
Constructor that wraps (not copies). |
protected |
SynchronizedList(java.util.List list,
java.lang.Object lock)
Constructor that wraps (not copies). |
Method Summary | |
---|---|
void |
add(int index,
java.lang.Object object)
|
boolean |
addAll(int index,
java.util.Collection coll)
|
static java.util.List |
decorate(java.util.List list)
Factory method to create a synchronized list. |
java.lang.Object |
get(int index)
|
protected java.util.List |
getList()
Gets the decorated list. |
int |
indexOf(java.lang.Object object)
|
int |
lastIndexOf(java.lang.Object object)
|
java.util.ListIterator |
listIterator()
Iterators must be manually synchronized. |
java.util.ListIterator |
listIterator(int index)
Iterators must be manually synchronized. |
java.lang.Object |
remove(int index)
|
java.lang.Object |
set(int index,
java.lang.Object object)
|
java.util.List |
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(java.util.List list)
list
- the list to decorate, must not be null
java.lang.IllegalArgumentException
- if list is nullprotected SynchronizedList(java.util.List list, java.lang.Object lock)
list
- the list to decorate, must not be nulllock
- the lock to use, must not be null
java.lang.IllegalArgumentException
- if list is nullMethod Detail |
---|
public static java.util.List decorate(java.util.List list)
list
- the list to decorate, must not be null
java.lang.IllegalArgumentException
- if list is nullprotected java.util.List getList()
public void add(int index, java.lang.Object object)
add
in interface java.util.List
public boolean addAll(int index, java.util.Collection coll)
addAll
in interface java.util.List
public java.lang.Object get(int index)
get
in interface java.util.List
public int indexOf(java.lang.Object object)
indexOf
in interface java.util.List
public int lastIndexOf(java.lang.Object object)
lastIndexOf
in interface java.util.List
public java.util.ListIterator listIterator()
synchronized (coll) { ListIterator it = coll.listIterator(); // do stuff with iterator }
listIterator
in interface java.util.List
public java.util.ListIterator listIterator(int index)
synchronized (coll) { ListIterator it = coll.listIterator(3); // do stuff with iterator }
listIterator
in interface java.util.List
public java.lang.Object remove(int index)
remove
in interface java.util.List
public java.lang.Object set(int index, java.lang.Object object)
set
in interface java.util.List
public java.util.List subList(int fromIndex, int toIndex)
subList
in interface java.util.List
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |