You can use flatMap
to flatten the internal lists (after converting them to Streams) into a single Stream, and then collect the result into a list:
List<List<Object>> list = ...
List<Object> flat =
list.stream()
.flatMap(List::stream)
.collect(Collectors.toList());
More Related Contents:
- Java 8 Distinct by property
- How to force max to return ALL maximum values in a Java Stream?
- Java 8: performance of Streams vs Collections
- Java 8 Nested (Multi level) group by
- Should I return a Collection or a Stream?
- What is difference between Collection.stream().forEach() and Collection.forEach()?
- Lambda expression to convert array/List of String to array/List of Integers
- Retrieving a List from a java.util.stream.Stream in Java 8
- How do I keep the iteration order of a List when using Collections.toMap() on a stream?
- Why does Collections.sort use Mergesort but Arrays.sort does not?
- How can I get a List from some class properties with Java 8 Stream?
- What Java 8 Stream.collect equivalents are available in the standard Kotlin library?
- Getting object with max date property from list of objects Java 8
- Perform operation on n random distinct elements from Collection using Streams API
- Java 8 stream map to list of keys sorted by values
- finalize() called on strongly reachable objects in Java 8
- Why aren’t Java Collections remove methods generic?
- Why should Java 8’s Optional not be used in arguments
- Java 8: Difference between two LocalDateTime in multiple units
- What does the arrow operator, ‘->’, do in Java?
- How to randomize two ArrayLists in the same fashion?
- Purpose of Default or Defender methods in Java 8
- Observer is deprecated in Java 9. What should we use instead of it?
- How to dynamically do filtering in Java 8?
- Equivalent of Scala dropWhile
- Java 8 forEach with index [duplicate]
- incompatible types: inference variable T has incompatible bounds [duplicate]
- In what situations is the CopyOnWriteArrayList suitable? [duplicate]
- Why are new java.util.Arrays methods in Java 8 not overloaded for all the primitive types?
- Implement recursive lambda function using Java 8