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());

 

打印结果

posted on 2014-05-08 20:28  alex_wongh  阅读(431)  评论(0编辑  收藏  举报