Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVA

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());
        }
    }
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #JAVA #HashMap #keys #values
ADD COMMENT
Topic
Name
4+1 =