Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/316.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/sorting/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java HashMap,按值排序_Java_Sorting - Fatal编程技术网

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.
列表
对不起,我听不懂你说了什么。。你能给我写所有代码来排序吗?这不是一个“你能给我写所有代码”的网站。如果你被困住了,展示你的努力并问你具体的问题。不要乞求代码,让自己显得懒惰。