title: Java 8 Stream "collect and group by" objects that map to multiple keys
body: <p>I have the following objects:</p>
  
  <pre><code>public class Item {
      String value;
      List&lt;Person&gt; owners;
      Person creator;
  }
  
  public class Person {
      String name;
      int id;
      Person manager;
  }
  </code></pre>
  
  <p>now i have the a list containing 3 Item objects:</p>
  
  <pre><code>i1 -&gt; {value="1", owners=[p1, p2, p3], creator=p4}
  i2 -&gt; {value="2", owners=[p2, p3], creator=p5}
  i3 -&gt; {value="3", owners=[p5], creator=p1}
  </code></pre>
  
  <p>the Person objects are as follows:</p>
  
  <pre><code>p1 -&gt; {manager=m1, ...}
  p2 -&gt; {manager=m2, ...}
  p3 -&gt; {manager=m3, ...}
  p4 -&gt; {manager=m2, ...}
  p5 -&gt; {manager=m1, ...}
  </code></pre>
  
  <p>I want to group the stream of Item objects based on managers of the owners and creator. The result <code>Map&lt;Person, List&lt;Item&gt;&gt;</code> should look like:</p>
  
  <pre><code>{
    m1: [i1, i2, i3],
    m2: [i1, i2],
    m3: [i1, i2]
  }
  </code></pre>
  
  <p>I think using Stream and Collector APIs, I can make the map from Item to managers, <code>Map&lt;Item, List&lt;Person&gt;&gt;</code> first, then reverse the mapping. But is there any way to make the mapping I want using Stream and Collectors only?</p>