I have a hashmap with some keys pointing to same values. I want to find all the values that are equal and print the corresponding keys.
This is the current code that I
You can use streams to retrive duplicates in this way:
List myList = map.stream() .filter(n -> Collections.frequency(map.values(), n) > 1) .collect(Collectors.toList());
And then, you can print this out with:
myList.foreach(System.out::println);