map排序

map 排序

map.entrySet().stream().sorted((o1, o2) -> {
  return o2.getValue() - o1.getValue();
}).collect(Collectors.toList()).forEach(ele->map.put(ele.getKey(),ele.getValue()));
posted @ 2021-10-22 17:32  能借我十块钱吗  阅读(31)  评论(0编辑  收藏  举报