分组
List<Map> mapList = new ArrayList<>();
Map<String,List<Map>> mapListGroup = mapList.stream().collect(Collectors.groupingBy(e->e.get("xxx").toString()));
最大值最小值
int max = maps.stream().mapToInt(e -> new Integer(String.valueOf(e.get("value")))).max().orElse(0);
int min = maps.stream().mapToInt(e ->new Integer(String.valueOf(e.get("value")))) .min().orElse(0);
// 最大值double totalDay = teampGroup.stream().mapToDouble(m -> (Double) m.getOrDefault("totalDay", Double.MIN_VALUE)).max().getAsDouble();
遍历某个字段
teampGroups.stream().forEach(map ->map.forEach((key, val) ->{if ("componentType".equals(key)) {String[] split = String.valueOf(val).split(",");for (String str : split) {componentTypeSet.add(str);}}}));
遍历list<map> 某个字段值相加
BigDecimal sum = list.stream().map(x -> new BigDecimal(String.valueOf(x.get("score")))).reduce(BigDecimal.ZERO,BigDecimal::add);