Nested Streams java 8

Trying to use Java 8 Streams for this

 HashMap<String,Games> groupGames = new HashMap<String,Games> ();
 for(Groups group: groups){
    for(int groupId : group.getGroupId){
          groupGames.put(groupId, group.getGame());

This works fine butI want to use java 8 stream to achieve this same functionality.

This is what I have for stream

public void toStream(List<Group> group){ -> groups.getGroupIds())
            .flatMap(group ->;

I’m having hard time putting each of the groupId with the game in the hashmap…I’m able to flatten out the list of groupIds