Stream List<List<Object>> 转 List<Object>

Stream List<List<Object>> 转 List<Object>

List collect = authors.stream().map(Author::getBookList).flatMap(Collection::stream).collect(Collectors.toList());

List collect1 = authors.stream().map(Author::getBookList).flatMap(author-> author.stream()).collect(Collectors.toList());
      

你可能感兴趣的:(java,Stream,java)