title: How to filter nested loops using Java 8 streams and filters?
body: <p>I have two simple POJOs:</p>
  
  <pre><code>public class Parent {
      String name;
      List&lt;Child&gt; children = new ArrayList&lt;&gt;();
      void addChild(Integer age) { children.add(new Child(age)); }
  }
  
  public class Child {
      Integer age;
  }
  </code></pre>
  
  <p>Then I generate some data, I add for parent 100 children:</p>
  
  <pre><code>List&lt;Parent&gt; parentList = new ArrayList&lt;&gt;();
  
  Parent first = new Parent("first");
  for (int i = 0; i &lt; 100; ++i) { first.addChild(i); }
  parentList.add(first);
  </code></pre>
  
  <p>My goal is to remove all children younger than ten:</p>
  
  <pre><code>parentList.stream().forEach(parent -&gt; {
      parent.setChildren(getChildrenOlderThan(parent));
  });
  
  List&lt;Child&gt; getChildrenOlderThan10(Parent parent) {
      return parent.getChildren().stream()
          .filter(child -&gt; child.getAge() &gt; 10)
          .collect(Collectors.toList());
  }
  </code></pre>
  
  <p>Finally I have list children older than ten. But I do not want to write a separate method getChildrenOlderThan.</p>
  
  <p>How to get all parents with list chilrden older than ten using only the single stream? </p>