What is the (kind of) inverse operation to Java's Stream.flatMap()?
问题 The Stream.flatMap() operation transforms a stream of a, b, c into a stream that contains zero or more elements for each input element, e.g. a1, a2, c1, c2, c3 Is there the opposite operations that batches up a few elements into one new one? It is not .reduce(), because this produces only one result It is not collect(), because this only fills a container (afaiu) It is not forEach(), because this has returns just void and works with side effects Does it exist? can I simulate it in any way?