Java HashMap,按值排序
可能重复:Java HashMap,按值排序,java,sorting,Java,Sorting,可能重复: 你好,你能帮我解决我的排序问题吗 HashMap<String, Integer> hm = new HashMap<String, Integer>(); hm.put("Berkan Cetin", 100); hm.put("Mahmut Koca", 78); hm.put("Rifat Sarili", 89); hm.put("Cagdas Polat", 61); hm.put("Gulay Uygun", 56); HashMap hm=n
你好,你能帮我解决我的排序问题吗
HashMap<String, Integer> hm = new HashMap<String, Integer>();
hm.put("Berkan Cetin", 100);
hm.put("Mahmut Koca", 78);
hm.put("Rifat Sarili", 89);
hm.put("Cagdas Polat", 61);
hm.put("Gulay Uygun", 56);
HashMap hm=newhashmap();
hm.put(“Berkan Cetin”,100);
hm.put(“Mahmut Koca”,78);
hm.put(“Rifat Sarili”,89);
hm.put(“Cagdas Polat”,61);
hm.put(“古莱维根”,56岁);
例如,在那里,如果我想按键排序,我可以使用TreeMap
或其他方法,但我找不到根据值从最大到最小的Integer
排序的方法
谢谢您可以执行类似于
新建树集(map.keySet())
的操作来获得一组已排序的键
地图本身并不是你可以分类的东西。重复太多而无法计数;只是,HashMap没有顺序。您必须使用不使用或不使用地图的集合。e、 g.
列表
对不起,我听不懂你说了什么。。你能给我写所有代码来排序吗?这不是一个“你能给我写所有代码”的网站。如果你被困住了,展示你的努力并问你具体的问题。不要乞求代码,让自己显得懒惰。