What is the (kind of) inverse operation to Java's Stream.flatMap()? : <p>The <code>Stream.flatMap()</code> operation transforms a stream of </p>

<pre><code>a, b, c
</code></pre>

<p>into a stream that contains zero or more elements for each input element, e.g. </p>

<pre><code>a1, a2, c1, c2, c3
</code></pre>

<p>Is there the opposite operations that batches up a few elements into one new one?</p>

<ul>
<li>It is not .reduce(), because this produces only one result</li>
<li>It is not collect(), because this only fills a container (afaiu)</li>
<li>It is not forEach(), because this has returns just <code>void</code> and works with side effects</li>
</ul>

<p>Does it exist? can I simulate it in any way?</p>
