Answers for "java hashmap keyset to list of values"

1

Java get list of keys Hashmap

List<String> l = new ArrayList<String>(map.keySet());
Posted by: Guest on May-17-2021
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"

Java Answers by Framework

Browse Popular Code Answers by Language