提示:您可在线编辑运行本教程的实例 - 运行实例,去试试!
获取存储在Java TreeMap中的最低和最高密钥
//N o w J a v a . c o m - 时 代 Java 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"); System.out.println("Lowest key Stored in Java TreeMap is : " + treeMap.firstKey()); } }