java8的flatmap

List<String>  resultList = wmPoiLogisticsSubmitRequestDTOList.stream()
.flatMap(wmPoiLogisticsSubmitRequestDTOTemp -> wmPoiLogisticsSubmitRequestDTOTemp.getLogisticsList().stream())
.filter(wmPoiLogisticsDTO -> "333333".equals(wmPoiLogisticsDTO.getLogisticsCode()) || "111111".equals(wmPoiLogisticsDTO.getLogisticsCode()) )
.map(wmPoiLogisticsDTO -> wmPoiLogisticsDTO.getName() )
.collect(Collectors.toList());
posted @ 2022-04-29 21:36  沙漠里的小鱼  阅读(492)  评论(0编辑  收藏  举报