1.8集合操作
排序
Collections.sort(list, (a,b)->b.getThirdTypeId().compareTo(a.getThirdTypeId()));
转换list
List list=new ArrayList<>();
list.stream().map(Goods::getGoodsId).collect(Collectors.toList());
转map
Map collect = list1.stream().collect(Collectors.toMap(Integer::intValue, Function.identity()));
List<String> 转 List<Long>
List<Long> ids = Lists.newArrayList(strings.stream().mapToLong(Long::valueOf).iterator());
筛选
String commonText = options.stream().filter(x -> !x.getIsOther()).map(QuestionOption::getText).collect(Collectors.joining(","));
List<QuestionnaireUsrAnswer> addList = answers.stream().filter(e -> e.getId() == null).collect(Collectors.toList());
分组转map
List<BusinessSummaryDto> summary = newStatisticsMapper.summary(summaryQueryVo);
Map<Integer, List<BusinessSummaryDto>> listMap = summary.stream().collect(Collectors.groupingBy(e -> e.getCustomerType()));