title: Nested Streams java 8
body: <p>Trying to use Java 8 Streams for this</p>
  
  <pre><code> HashMap&lt;String,Games&gt; groupGames = new HashMap&lt;String,Games&gt; ();
   for(Groups group: groups){
      for(int groupId : group.getGroupId){
            groupGames.put(groupId, group.getGame());
      }
   }
  </code></pre>
  
  <p>This works fine but I want to use <code>java 8</code> stream to achieve this same functionality.</p>
  
  <p>This is what I have for stream</p>
  
  <pre><code>public void toStream(List&lt;Group&gt; group){
      group.stream().map(groups -&gt; groups.getGroupIds())
              .flatMap(group -&gt; groups.stream()).collect(Collectors.toList());
  }
  </code></pre>
  
  <p>I'm having hard time putting each of the groupId with the game in the hashmap... <br>I'm able to flatten out the list of groupIds</p>