не могу найти ошибку. помогите , пожалуйста...
package com.javarush.task.task08.task0817;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;
/*
Нам повторы не нужны
*/
public class Solution {
public static HashMap<String, String> createMap() {
HashMap <String, String> list = new HashMap<>();
list.put("firstname1", "name1");
list.put("firstname2", "name2");
list.put("firstname3", "name3");
list.put("firstname4", "name4");
list.put("firstname5", "name5");
list.put("firstname6", "name6");
list.put("firstname7", "name1");
list.put("firstname8", "name1");
list.put("firstname9", "name1");
list.put("firstname10", "name1");
return list;
}
public static void removeTheFirstNameDuplicates(Map<String, String> map) {
ArrayList <String> listValue = new ArrayList<>(map.values());
for (int i=0 ; i<listValue.size(); i++){
String s = listValue.get(i);
for (int j = 1; j<listValue.size(); j++){
if (s.equals(listValue.get(j)))
removeItemFromMapByValue(map,listValue.get(j));
}
}
}
public static void removeItemFromMapByValue(Map<String, String> map, String value) {
HashMap<String, String> copy = new HashMap<String, String>(map);
for (Map.Entry<String, String> pair : copy.entrySet()) {
if (pair.getValue().equals(value))
map.remove(pair.getKey());
}
}
public static void main(String[] args) {
}
}