What's the problem with my code?
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() {
//write your code here
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) {
//write your code here
for (Iterator<Map.Entry<String, String>> ma1 = map.entrySet().iterator(); ma1.hasNext();)
{
Map.Entry<String, String> a = ma1.next();
String value1 = a.getValue();
for (Iterator<Map.Entry<String, String>> ma2 = map.entrySet().iterator(); ma2.hasNext();){
Map.Entry<String, String> b = ma2.next();
String value = b.getValue();
if (value1.equals(value)){
removeItemFromMapByValue(map, value);
}
}
}
}
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) {
}
}