Package java.util
Class Collections
static SortedSet synchronizedSortedSet(SortedSet s)
_INSERT_METHOD_SIGNATURE_HERE_
Description:
Returns a synchronized (thread-safe) sorted set backed by the specified sorted set. In order to guarantee serial access, it is critical that all access to the backing sorted set is accomplished through the returned sorted set.
The user has to manually synchronize on the returned sorted set when iterating over it:
synchronized(MySortedSet) { // iterate in a synchronized block
Iterator i = MySortedSet.iterator();
while (i.hasNext())
myFun(i.next());
}
The returned collection will be serializable if the specified sorted set is serializable.