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