print the keys of hashmap with given value code example
Example 1: print elements in map java
// Java 8 - Collection.iterator() + Iterator.forEachRemaining()
map.keySet().iterator()
.forEachRemaining(System.out::println);
Example 2: print only values in map
System.out.println(Arrays.toString(map.entrySet().toArray()));