Java tutorial
//package com.java2s; import java.util.Comparator; import java.util.Map; import java.util.SortedMap; import java.util.TreeMap; public class Main { public static <K, V> TreeMap<K, V> getTreeMap() { return new TreeMap<K, V>(); } public static <K, V> TreeMap<K, V> getTreeMap(Comparator<? super K> comparator) { return new TreeMap<K, V>(comparator); } public static <K, V> TreeMap<K, V> getTreeMap(Map<? extends K, ? extends V> map) { return new TreeMap<K, V>(map); } public static <K, V> TreeMap<K, V> getTreeMap(SortedMap<K, ? extends V> map) { return new TreeMap<K, V>(map); } }