title: convert a list objects with list to map in Java 8 by stream
body: <p>I have the following classes:</p>
  
  <pre class="lang-java prettyprint-override"><code>class A {
     String id;
     List&lt;B&gt; b;
  }
  
  class B {
     String id;
  }
  
  </code></pre>
  
  <p>And I have a list of a's that I would like to convert to a map with the following logic:</p>
  
  <pre><code>List&lt;A&gt; aList;
  
  Map&lt;String, String&gt; map; 
  
  for (A a:aList)
  {
     for (B b:aList.b)
     {
        map.put(b.id, a.id)
     }
  }  
  </code></pre>
  
  <p>What is the best way to do it in one line of stream method?</p>
  
  <p>Thanks
  Elad</p>