【发布时间】:2020-07-23 18:19:26
【问题描述】:
如何找到五个?
HashMap<Integer, Integer> hmap = new HashMap<Integer, Integer>();
hmap.put(98, 3);
hmap.put(-120, 2);
hmap.put(12, 5);
hmap.put(344, 1);
hmap.put(-220, 1);
我试过了,但它不喜欢我的 hmap。
System.out.println(Collections.max(hmap));
【问题讨论】:
-
尝试一下谷歌搜索,我会链接你这个:docs.oracle.com/javase/8/docs/api/java/util/…
-
欢迎来到 Stack Overflow。我的搜索引擎很容易找到这个:Finding the Highest Value in a Java Map。 I downvoted because research must be done to ask a good question.
-
Stackoverflow 是回答您的问题的好地方,但没有什么可以代替一项好的研究。您很有可能会遇到回答您确切问题的帖子。不要因投反对票而紧张。许多人倾向于将拒绝投票作为一种特权。