提示:您可在线编辑运行本教程的实例 - 运行实例,去试试!
从TreeMap获取头部地图
//from N o w J a v a . c o m - 时 代 Java import java.util.SortedMap; import java.util.TreeMap; public class Main { public static void main(String[] args) { TreeMap treeMap = new TreeMap(); treeMap.put("1","One"); treeMap.put("3","Three"); treeMap.put("2","Two"); treeMap.put("5","Five"); treeMap.put("4","Four"); SortedMap sortedMap = treeMap.headMap(