Example usage for java.util Collections checkedSortedMap

List of usage examples for java.util Collections checkedSortedMap

Introduction

In this page you can find the example usage for java.util Collections checkedSortedMap.

Prototype

public static <K, V> SortedMap<K, V> checkedSortedMap(SortedMap<K, V> m, Class<K> keyType, Class<V> valueType) 

Source Link

Document

Returns a dynamically typesafe view of the specified sorted map.

Usage

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
}