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){
    group.stream().map(groups -> groups.getGroupIds())
            .flatMap(group -> groups.stream()).collect(Collectors.toList());
}

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