Get Synchronized Set from TreeSet in Java
Description
The following code shows how to get Synchronized Set from TreeSet.
Example
/*from w w w. ja va 2s .co m*/
import java.util.Collections;
import java.util.Set;
import java.util.TreeSet;
public class Main {
public static void main(String[] args) {
TreeSet treeSet = new TreeSet();
Set set = Collections.synchronizedSet(treeSet);
}
}
The code above generates the following result.