Get keys from HashMap in Java
I have a Hashmap in Java like this: private Map<String, Integer> team1 = new HashMap<String, Integer>(); Then I fill it like this: team1.put(“United”, 5); How can I get the keys? Something like: team1.getKey() to return “United”. 15 Answers 15