Answers for "JAVA HashMap get keys by values"

0

JAVA HashMap get keys by values

Map<String, String> map = new HashMap<String, String>();
    
    map.put("abc", "123");
    map.put("xyz", "456");
    
    for(Entry<String, String> entry : map.entrySet()) {
        if(entry.getValue().equalsIgnoreCase("456")) {
            System.out.println(entry.getKey());
        }
    }
Posted by: Guest on September-12-2021

Code answers related to "JAVA HashMap get keys by values"

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language