title: Flattening a List of List to a List with Java 8 stream API
body: <p>I have the following code which could be much simpler using Java 8 stream API:</p>
  
  <pre><code>List&lt;List&lt;String&gt;&gt; listOfListValues;
  public List&lt;String&gt; getAsFlattenedList() {
          List&lt;String&gt; listOfValues= new ArrayList&lt;&gt;();
          for (List&lt;String&gt; value: listOfListValues) {
              listOfValues.add(String.valueOf(value));
          }
          return listOfValues;
      }
  </code></pre>
  
  <p>I searched for a solution on SO and found this:</p>
  
  <pre><code>listOfListValues.stream()
          .flatMap(List::stream)
          .collect(Collectors.toList());
  </code></pre>
  
  <p>But this doesn't do the same what I want.</p>