title: Split list of words using streams in Java
body: <p>I am having this method that takes a number of lists, which contain lines of books. I am combing them to a stream to then iterate over them to split on all non-letter's <code>\\P{L}</code>. </p>
  
  <p>Is there a way to avoid the for-each loop and process this within a stream?    </p>
  
  <pre><code>private List&lt;String&gt; getWordList(List&lt;String&gt;... lists) {
          List&lt;String&gt; wordList = new ArrayList&lt;&gt;();
  
          Stream&lt;String&gt; combinedStream = Stream.of(lists)
                  .flatMap(Collection::stream);
          List&lt;String&gt; combinedLists = combinedStream.collect(Collectors.toList());
  
          for (String line: combinedLists) {
              wordList.addAll(Arrays.asList(line.split("\\P{L}")));
          }
  
          return wordList;
  }
  </code></pre>