HashMap<Integer,Integer> hashmapsample= new HashMap<Integer, Integer>();
I can have values like
(1 , 7)
(2 , 4)
(4 , 5)
(3, 7)
There wont be any duplicate Keys . Only Duplicate values can occur
I want to pick the (Key,Value) pair which has duplicate values.
If I get the Duplicate (Key,Value) as another Hashmap it would be great.
How Do I go about it.?
I expect the output
(1 , 7)
(3, 7)
How about this?
This method will return key/value pairs for all the duplicate values in the input HashMap.
Test code:
Output: