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