Online Java Compiler By
JavaTpoint.com
import java.util.*; public class CollectionsCheckedSortedSetExample2 { public static void main(String[] args) { TreeSet
set = new TreeSet<>(); //Insert values in the Set set.add(1100); set.add(100); set.add(500); set.add(200); //Get type safe view of the Set SortedSet
TypeSafeSet; TypeSafeSet = Collections.checkedSortedSet(set,Integer.class); System.out.println("The view of the Sorted Set is: "+TypeSafeSet); } }
Output