TreeMap的使用

Map<Integer, String> map = new TreeMap<Integer, String>();//TreeMap本身具有排序功能(默认按键升序排序)

map.put(12, "hello");

map.put(7, "bravestarr");

map.put(20, "world");

System.out.println(map.toString());

打印结果

原文地址:https://www.cnblogs.com/bravestarrhu/p/3716941.html