Remove duplicate values from HashMap in Java
问题 I have a map with duplicate values: ("A", "1"); ("B", "2"); ("C", "2"); ("D", "3"); ("E", "3"); I would like to the map to have ("A", "1"); ("B", "2"); ("D", "3"); Do you know how to get rid of the duplicate values? At present, I get 'java.util.ConcurrentModificationException' error. Thank you. public static void main(String[] args) { HashMap<String, String> map = new HashMap<String, String>(); map.put("A", "1"); map.put("B", "2"); map.put("C", "2"); map.put("D", "3"); map.put("E", "3"); Set