Java 8 代码优化:使用 Stream API 获取列表数据
<p>private Collection<List<List<Object>>> getSheetDatas(final String activityId) {
final List<MidLevelDemocracyEvaluationVO> midLevelDemocracyEvaluations = getMidLevelDemocracyEvaluations(activityId);
final Map<Integer, List<List<Object>>> collect = CollectionUtils.emptyIfNull(midLevelDemocracyEvaluations)
.stream()
.collect(Collectors.groupingBy(MidLevelDemocracyEvaluationVO::getOrgSort, LinkedHashMap::new, Collectors.mapping(this::createDataObjects, Collectors.toList())));
return collect.values();
}</p>
原文地址: https://www.cveoy.top/t/topic/p9Sg 著作权归作者所有。请勿转载和采集!