java.lang.Object | +--org.apache.commons.collections.collection.SynchronizedCollection | +--org.apache.commons.collections.list.SynchronizedListAll Implemented Interfaces:
SynchronizedList(List list) Constructor that wraps (not copies). |
SynchronizedList(List list, Object lock) Constructor that wraps (not copies). |
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) |
List | getList() Gets the decorated list. |
int | indexOf(Object object) |
int | lastIndexOf(Object object) |
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) |
protected SynchronizedList(List list, Object lock)
- if list is nullprotected SynchronizedList(List list)
- if list is nullpublic void add(int index, Object object)
public boolean addAll(int index, Collection coll)
public static List decorate(List list)
- if list is nullpublic Object get(int index)
protected List getList()
public int indexOf(Object object)
public int lastIndexOf(Object object)
public ListIterator listIterator()
synchronized (coll) { ListIterator it = coll.listIterator(); // do stuff with iterator
public ListIterator listIterator(int index)
synchronized (coll) { ListIterator it = coll.listIterator(3); // do stuff with iterator
public Object remove(int index)
public Object set(int index, Object object)
public List subList(int fromIndex, int toIndex)
List
to synchronize its behaviour for a multi-threaded environment. Methods are synchronized, then forwarded to the decorated list.