Get Synchronized Set from TreeSet - Java Collection Framework

Java examples for Collection Framework:TreeSet

Description

Get Synchronized Set from TreeSet

Demo Code

 
import java.util.TreeSet;
import java.util.Collections;
import java.util.Set;
 
public class Main {
 
  public static void main(String[] args) {
    TreeSet treeSet = new TreeSet();
   //  ww w.  java  2 s .  c o m
    Set set = Collections.synchronizedSet(treeSet);
    
    System.out.println("done");
  }
}

Result


Related Tutorials