hashMap 获取里面value最大的值得key
2024-10-21 17:43:03
public static void main(String[] args) {
Map<String, Integer> map = new HashMap();
map.put("13213", 8);
Set<String> set=map.keySet();
map.entrySet();
List<Map.Entry<String,Integer>> list = new ArrayList(map.entrySet());
Collections.sort(list, (o1, o2) -> (o2.getValue() - o1.getValue()));//升序
System.out.println(list.get(0).getKey());
}
最新文章
- 常用prototype函数
- C语言编译和链接过程
- C语言的判断语句
- 我眼中的自己ps:自我介绍
- 数据结构线性表(js实现)
- 今天出现了一个问题,Tomcat 进入localhost:8080正常,进入项目内别的页面都是空白页
- 2018-2019-2 网络对抗技术 20165328 Exp3 免杀原理与实践
- java中的几个概念
- 题解-Codeforces710F String Set Queries
- python-中缀转换后缀并计算
- android xml 解析汉字只出来一个字的问题
- Error:Could not find com.github.dcendents:android-maven-plugin:1.5.
- 告别C#,进入了下一个阶段的学习啦
- TinyURL
- 随机梯度下降算法求解SVM
- 解决 spring cloud 项目的 com.netflix.hystrix.contrib.javanica.aop.aspectj.HystrixCommandAspect 错误信息
- Java集合类理解
- Python开发MapReduce系列(一)WordCount Demo
- ics httpDELETE 时增加 content,length 特别需求
- [ElasticSearch] 如何使用中文分詞ik與繁簡轉換stconvert插件
热门文章
- VLC播放器 for Mac OS X
- page-break-after:always 打印分页
- 初学银河麒麟linux笔记 第一章 虚拟机、麒麟系统、QT安装与运行
- 使用ESP8266连接中文wifi
- CCF 201912-1	报数
- python 链表推导式x for xx in yy
- 【转载】 VCS编译的基本参数,//code细节,注释
- wireshark抓包海康威视摄像头
- Angular中播放RTSP
- raise EOFError(";Compressed file ended before the "; EOFError: Compressed file ended before the end-of-stream marker was reached