How to check the number of keys have a certain value in a hashmap

Viewed 3335

What I am trying to figure out is how do you check if a hashmap (which in my case could have any number of keys) has only one of a certain value assigned to it. I'm struggling to explain this here.

If I have a hashmap with 10 keys (each is players in a game assigned to have a gamestate depending on what "gamestate" they are in) and there is only one player with the game state IN_GAME, then how do I check that there is in fact only one Key assigned with the value IN_GAME, and there isn't two keys with that value?

3 Answers
Related