Package java.util
Class Collections
static List synchronizedList(List l)
_INSERT_METHOD_SIGNATURE_HERE_
Description:
Returns a synchronized (thread-safe) list backed by the specified list. Changes in the returned list are reflected in this list, and vice-versa. In order to guarantee serial access, it is critical that all access to the backing list is accomplished through the returned list.
The user has to manually synchronize on the returned list when iterating over it:
synchronized(MyList) { // iterate in a synchronized block
Iterator i = MyList.iterator();
while (i.hasNext())
myFun(i.next());
}
The returned collection will be serializable if the specified list is serializable.