Java 8 Streams: Collapse/abstract streams parts : <p>Say I have this Stream:</p>

<pre><code>list.stream()
    .map(fn1)      // part1
    .map(fn2)      // 
    .filter(fn3)   // 

    .flatMap(fn4)  // part 2 
    .map(fn5)      //
    .filter(fn6)   //
    .map(fn7)      //
    .collect(Collectors.toList())
</code></pre>

<p>How can I make it look like:</p>

<pre><code>list.stream()
    .map(fnPart1)      
    .map(fnPart2)
    .collect(Collectors.toList())
</code></pre>

<p>Without manually unwinding the fnX parts and putting them together (for maintenance reasons, I want to keep them untouched, and express the fnPartX with them).</p>
