public static void main(String[] args) {
List<Map<String, Integer>> list = new ArrayList<>();
Map<String, Integer> map0 = new HashMap<>();
map0.put("0", 0);
Map<String, Integer> map1 = new HashMap<>();
map1.put("1", 1);
Map<String, Integer> map2 = new HashMap<>();
map2.put("2", 2);
Map<String, Integer> map3 = new HashMap<>();
map3.put("3", 3);
list.add(map1);
list.add(map3);
list.add(map1);
list.add(map2);
list.add(map0);
//从大到小
list.sort(Comparator.comparingInt(JavaSE::comparingByValue).reversed());
//从小到大
list.sort(Comparator.comparingInt(JavaSE::comparingByValue));
System.out.println(list.size());
}
private static Integer comparingByValue(Map<String, Integer> map) {
return map.values().iterator().next();
}