i cant find the error
package com.codegym.task.task08.task0817;
import java.util.HashMap;
import java.util.Map;
import java.util.Iterator;
/*
We don't need repeats
*/
public class Solution {
public static HashMap<String, String> createMap() {
HashMap<String,String> map = new HashMap<String,String>();
map.put("a", "d");
map.put("b", "d");
map.put("c", "qd");
map.put("d", "d");
map.put("e", "q");
map.put("f", "w");
map.put("g", "e");
map.put("h", "e");
map.put("i", "t");
map.put("j", "a");
return map;
}
public static void removeFirstNameDuplicates(Map<String, String> map) {
int count=0;
int no = 0;
HashMap<String,String> copy = new HashMap<String,String>(map);
Iterator<Map.Entry<String,String>> itr = copy.entrySet().iterator();
while(itr.hasNext()){
String value1=itr.next().getValue();
System.out.println(value1);
Iterator<Map.Entry<String,String>> itr2 = copy.entrySet().iterator();
while(itr2.hasNext()){
String value2=itr2.next().getValue();
if(value1.equals(value2)){
count++;
}
if(count>1){
removeItemFromMapByValue(map,value2);
no=1;
}
}
if(no==1){
removeItemFromMapByValue(map,value1);
}
no=0;
}
}
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) {
}
}