Online Java Compiler By
JavaTpoint.com
import java.util.*; public class CollectionsCheckedSortedMapExample2 { public static void main(String[] args) { //create map SortedMap
smap = new TreeMap
(); //Insert values in the Map smap.put(1100, "JavaTpoint"); smap.put(500, "Hindi100"); smap.put(1800, "SSSIT"); smap.put(900, "ABCD"); //Get type safe view of the sorted Map System.out.println("Type safe view of the Sorted Map is: "+Collections.checkedSortedMap(smap,Integer.class,String.class)); } }
Output