I really don't know what's wrong with my code. Can someone help me?
package zh.codegym.task.task08.task0817;
import java.util.HashMap;
import java.util.Map;
import java.util.*;
/*
我们不需要重复的内容
*/
public class Solution {
public static HashMap<String, String> createMap() {
//在此编写你的代码
HashMap<String,String> map = new HashMap<String,String>();
for(int i = 0; i<10; i++){
map.put("Lastname" + i, "FirstName" + i);
}
return map;
}
public static void removeFirstNameDuplicates(Map<String, String> map) {
//在此编写你的代码
String strvalue = null;
Iterator<Map.Entry<String,String>> iterateMap = map.entrySet().iterator();
while(iterateMap.hasNext()){
Map.Entry<String,String> pair = iterateMap.next();
strvalue = pair.getValue();
removeItemFromMapByValue(map,strvalue);
}
}
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) {
}
}