首页 > 编程语言 > 详细

List排序 仅限jdk8以上

时间:2021-07-02 15:25:14      阅读:37      评论:0      收藏:0      [点我收藏+]

List<Map<String,Object>> urls = new ArrayList<>();

for () {

Map<String,Object> map = new HashMap<>();
map.put("playurl", prefixUrl + path);
map.put("resultcode", "0");
map.put("definition", definition);

urls.add(map);

}

// 按 definition 升序排序
urls.sort((x, y) -> Integer.compare((Integer) x.get("definition"), (Integer) y.get("definition")));

List排序 仅限jdk8以上

原文:https://www.cnblogs.com/f9264/p/14962578.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!