Is there any simple way to identify duplicate values in a HashMap
?
HashMap<Integer, String> map= new HashMap<Integer, String>();
map.put(1, "a");
map.put(2, "a");
map.put(3, "b");
I want to save the duplicate value in a variable named String duplicate
.
I want the output a
.
Thank you all for your help, I'll try your tips. Thanks!