A bit late, but the reason why activeGames.getOrDefault(id, Game(id)) always creates a new game is that you create a Game instance as an argument to be passed to getOrDefault(). When getOrDefault() starts, the instance has already been created.