Online Java Compiler By
JavaTpoint.com
import java.util.*; public class CollectionsCheckedMapExample1 { public static void main(String[] args) { //create map HashMap
hmap = new HashMap
(); //Insert values in the Map hmap.put("A", 11); hmap.put("B", 12); hmap.put("C", 13); hmap.put("V", 14); //Create type safe view of the Map System.out.println("Type safe view of the Map is: "+Collections.checkedMap(hmap,String.class,Integer.class)); } }
Output