eg:List<List
像这种形式的,我们应该如何合并成一个集合给前端呢,我首选stream
首先已经存在这个集合
List<List<DetailVo>> listEnd = new ArrayList<>();
for (GetDetailDto ruleVo : list) {
List<DetailVo> rank = rank(ruleVo, resultList);
listEnd.add(ranking);
resultList = resultList.stream().filter(element -> !ranking.contains(element)).collect(Collectors.toList());
}
//在这一步,进行集合的合并
List<DetailVo> collect = listEnd.stream().flatMap(List::stream).collect(Collectors.toList());
标签:stream,listEnd,合并,中有,resultList,collect,集合,List
From: https://www.cnblogs.com/psuitj/p/18029025