提示:您可在线编辑运行本教程的实例 - 运行实例,去试试!
要从Java TreeMap中获取尾图,可以使用javatreemap类的SortedMap Tail Map(Object fromKey)方法。
/** 来 自 n o w j a v a . c o m**/ import java.util.SortedMap; import java.util.TreeMap; public class Main { public static void main(String[] args) { //create TreeMap object TreeMap treeMap = new TreeMap(); //add key value pairs to TreeMap treeMap.put("1","One"); treeMap.put("3","Three"); treeMap.put("2","Two"); treeMap.put("5","Five"); treeMap.put("4","nowjava.com"); SortedMap sortedMap = tre