This question already has an answer here:
Closed 3 years ago.
Is this possible (pseudo-Java):
someList = [
[1,2],
[3,4]
];
Stream<List<X>> a = someList.stream();
Stream<X> b = a.whatever(...);
assert b.collect(list).equals([1,2,3,4]);
Put more generally, is there an operation on a stream that can increase the number of elements in the stream (rather than decrease, as filter
does)?