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