can anyone help me plz?
package com.codegym.task.task08.task0817;
import java.util.HashMap;
import java.util.Map;
import java.util.Iterator;
import java.util.HashSet;
/*
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", "b");
map.put("c", "d");
map.put("e", "f");
map.put("g", "f");
map.put("r", "j");
map.put("l", "k");
map.put("m", "n");
map.put("o", "p");
map.put("q", "i");
map.put("s", "t");
return map;
}
public static void removeFirstNameDuplicates(Map<String, String> map) {
HashSet<String> set = new HashSet<String>();
int count = 0;
for(String s: map.values()){
for(String snew :map.values()){
if(s.equals(snew))
count++;
}
if(count>1)
set.add(s);
}
for(String text : set)
{
removeItemFromMapByValue(map,text);
}
}
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) {
HashMap<String,String> map = createMap();
System.out.println(map.values());
removeFirstNameDuplicates(map);
System.out.println(map.values());
}
}