|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.commons.collections.collection.SynchronizedCollection
org.apache.commons.collections.list.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(List list)
Constructor that wraps (not copies). |
protected |
SynchronizedList(List list,
Object lock)
Constructor that wraps (not copies). |
Method Summary | |
void |
add(int index,
Object object)
|
boolean |
addAll(int index,
Collection coll)
|
static List |
decorate(List list)
Factory method to create a synchronized list. |
Object |
get(int index)
|
protected List |
getList()
Gets the decorated list. |
int |
indexOf(Object object)
|
int |
lastIndexOf(Object object)
|
ListIterator |
listIterator()
Iterators must be manually synchronized. |
ListIterator |
listIterator(int index)
Iterators must be manually synchronized. |
Object |
remove(int index)
|
Object |
set(int index,
Object object)
|
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(List list)
list
- the list to decorate, must not be null
IllegalArgumentException
- if list is nullprotected SynchronizedList(List 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 List decorate(List list)
list
- the list to decorate, must not be null
IllegalArgumentException
- if list is nullprotected List getList()
public void add(int index, Object object)
add
in interface List
public boolean addAll(int index, Collection coll)
addAll
in interface List
public Object get(int index)
get
in interface List
public int indexOf(Object object)
indexOf
in interface List
public int lastIndexOf(Object object)
lastIndexOf
in interface List
public ListIterator listIterator()
synchronized (coll) { ListIterator it = coll.listIterator(); // do stuff with iterator }
listIterator
in interface List
public ListIterator listIterator(int index)
synchronized (coll) { ListIterator it = coll.listIterator(3); // do stuff with iterator }
listIterator
in interface List
public Object remove(int index)
remove
in interface List
public Object set(int index, Object object)
set
in interface List
public List subList(int fromIndex, int toIndex)
subList
in interface List
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |