Online Java Compiler By
JavaTpoint.com
import java.util.*; public class CollectionsCheckedSetExample1 { public static void main(String[] args) { TreeSet
set = new TreeSet
(); //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 Set is: "+Collections.checkedSet(set,String.class)); } }
Output