List of usage examples for java.util Collections checkedSortedMap
public static <K, V> SortedMap<K, V> checkedSortedMap(SortedMap<K, V> m, Class<K> keyType, Class<V> valueType)
From source file:Main.java
public static void main(String args[]) { SortedMap<String, String> smap = new TreeMap<String, String>(); smap.put("1", "tutorial"); smap.put("2", "from"); smap.put("3", "java2s.com"); // get typesafe view of the sorted map SortedMap<String, String> tsmap = Collections.checkedSortedMap(smap, String.class, String.class); System.out.println(tsmap);// w w w . j a va 2 s . co m }