stream的map排序
map根据key正序排序
1 | map.entrySet().stream().sorted(Comparator.comparing(e->e.getKey())) |
map根据key倒序排序
1 | map.entrySet().stream().sorted(Collections.reverseOrder |
map根据value正序排序
1 | map.entrySet().stream().sorted(Comparator.comparing(e->e.getValue())) |
map根据value倒序排序
1 | map.entrySet().stream().sorted(Collections.reverseOrder |