title: How to count items of nested lists?
body: <p>How can I use the Stream API to count items of nested lists?</p>
  
  <p>Imagine 3 nested lists:</p>
  
  <pre><code>List&lt;OuterList&gt; outerLists;
  
  class OuterList {
      List&lt;Sublist&gt; subLists;
  }
  
  class Sublist {
      List&lt;String&gt; items;
  }
  </code></pre>
  
  <p>I just want to sum the number of <code>items.size()</code> of all lists. I'm trying to achive something like:</p>
  
  <pre><code>outerLists.stream().forEach(outer -&gt; 
    outer.getSubLists().stream().forEach(sub -&gt; 
    sub.getItems().size())
   .sum/count()?
  </code></pre>