Online Java Compiler By
JavaTpoint.com
import java.util.*; public class CollectionsSynchronizedSortedSetExample1 { public static void main(String[] args) { //Create set SortedSet
set = new TreeSet
(); //Add values in the set set.add("Facebook"); set.add("Twitter"); set.add("Whatsapp"); set.add("Instagram"); //Create a synchronized sorted set Set
synset = Collections.synchronizedSortedSet(set); System.out.println("Synchronized Sorted set is :"+synset); } }
Output