title: Java 8 multiple level flatMap best implementation
body: <p>I have this two code examples: </p>
  
  <p>Code A:</p>
  
  <pre><code>Stream&lt;String&gt; aStream = firstLevelList.stream()
                              .flatMap(firstLevelElement -&gt; firstLevelElement.getSecondLevelList().stream()
                                  .flatMap(secondLevelElement -&gt; secondLevelElement.getThirdLevelList().stream()
                                      .map(thirdLevelElement -&gt; thirdLevelElement.toString())));
  </code></pre>
  
  <p>Code B:</p>
  
  <pre><code>Stream&lt;String&gt; aStream = firstLevelList.stream()
                              .flatMap(firstLevelElement -&gt; firstLevelElement.getSecondLevelList().stream())
                              .flatMap(secondLevelElement -&gt; secondLevelElement.getThirdLevelList().stream())
                              .map(thirdLevelElement -&gt; thirdLevelElement.toString());
  </code></pre>
  
  <p>Both have exactly the same result, which is the best implementation? Why?</p>