title: JAVA How to append the return value of .map() in a list instead of returning a list of list
body: <p>I have a java code something like</p>
  
  <pre><code>/*Statement A*/
  dataList.stream.map(ClassA::mapFunction).collect(Collectors.toList())
  </code></pre>
  
  <p>The catch is mapFunction has the following definition:</p>
  
  <pre><code>List&lt;Entry&gt; mapFunction(DataListItem dataListItem)
  </code></pre>
  
  <p>therefore the above stream().map() call returns <code>List&lt;List&lt;Entry&gt;&gt;</code></p>
  
  <p>What I want is that the return value should be <code>list&lt;Entry&gt;</code> (basically appending all the return values) and for that what I am currently doing is:</p>
  
  <pre><code>final List&lt;Entry&gt; entryList = new ArrayList&lt;&gt;();
  dataList.stream.map(dataListItem -&gt; entryList.addAll(ClassA.mapFunction(dataListItem))
                                     .collect(Collectors.toList());
  </code></pre>
  
  <p>Is there a clean way to append the mapFunction return values such that the outcome of Statement A is just a <code>List&lt;Entry&gt;</code> instead of <code>List&lt;List&lt;Entry&gt;&gt;</code>.</p>