Java TreeMap get tail sub map by key value
import java.util.SortedMap; import java.util.TreeMap; public class Main { public static void main(String[] args) { TreeMap<String, String> treeMap = new TreeMap<String,String>(); treeMap.put("1", "CSS"); treeMap.put("3", "Java"); treeMap.put("2", "HTML"); treeMap.put("5", "Five"); treeMap.put("4", "Four"); System.out.println(treeMap);/* w ww .j a va 2 s . c o m*/ SortedMap<String, String> sortedMap = treeMap.tailMap("2"); System.out.println(sortedMap); } }