title: Java 8 mapping to sub list entries of a collection using streams and collectors
body: <p>I have a collection of <code>Person</code> objects:.</p>
  
  <pre><code>public class Person {
  
    String name;
  
    ChildrenListHolder childrenListHolder;
  }
  
  public class ChildrenListHolder {
     List&lt;Children&gt; children;
  }
  
  public class Children {
     String childrensName;
  }
  </code></pre>
  
  <p>(The entity structure is given by third party.)</p>
  
  <p>Now, I need a <code>Map&lt;String,List&lt;Person&gt;&gt;</code> childrensName -> person-list</p>
  
  <p>For example (simplified):</p>
  
  <pre><code>Person father: {name: "John", childrensListHolder -&gt; {"Lisa", "Jimmy"}}
  Person mother: {name: "Clara", childrensListHolder -&gt; {"Lisa", "Paul"}}
  Person george: {name: "George", childrensListHold -&gt; "Paul"}}
  </code></pre>
  
  <p>The map, I need is</p>
  
  <pre><code>Map&lt;String, List&lt;Person&gt;&gt; map: {"Lisa"  -&gt; {father, mother},
                                  "Jimmy" -&gt; {father},
                                  "Paul"  -&gt; {mother, george}}
  </code></pre>
  
  <p>I can do that with a bunch of for's and if's. But how can I do this using streams and collectors. I have tried many approaches, but I cannot get the expected result. TIA.</p>