Online Java Compiler By
JavaTpoint.com
import java.util.*; public class CollectionsCheckedSortedSetExample1 { public static void main(String[] args) { TreeSet<String> set = new TreeSet<String>(); //Insert values in the Set set.add("JavaTpoint"); set.add("Hindi100"); set.add("SSSIT"); set.add("JavaTraining"); //Get type safe view of the Set System.out.println("Type safe view of the Sorted Set is: "+Collections.checkedSortedSet(set,String.class)); } }
Output