map排序

map 排序

map.entrySet().stream().sorted((o1, o2) -> {
  return o2.getValue() - o1.getValue();
}).collect(Collectors.toList()).forEach(ele->map.put(ele.getKey(),ele.getValue()));
原文地址:https://www.cnblogs.com/hujesse4/p/15440050.html