1.排序 (正序)
list.stream().sorted(Comparator.comparing(ExamScoreInfo::getSort)).collect(Collectors.toList());
2.提取集合内单一字成新的集合
list.stream().map(el -> el.getId()).collect(Collectors.toList());
3.list 转Map,并且含非空校验
Map<String, 对象> flowIdAndCheckIdMap = list.stream() .filter(el -> StringUtils.isNotBlank(el.getStaffId())) .collect(Collectors.groupingBy(el -> el.getStaffId()));
Map<String, String> flowIdAndCheckIdMap = checkList.stream().collect(Collectors.toMap(el -> el.getFlowId(), el -> el.getId()));
4.统计 (统计集合内某一字段 总计)
moduleScore = titleResultsDetailsScore.stream() .filter(t-> StringUtils.isNotBlank(t.getScore())) .collect(Collectors.toList()).stream() .map(e -> Integer.parseInt(e.getScore().replace(".0",""))) .reduce(Integer::sum).get();