public class Solution { public static HashMap<String, String> createMap() { //write your code here HashMap <String, String> map = new HashMap <> ( ); map.hashCode (); map.put ("Ivanov","Vasya"); map.put ("Vasilev","Vasya"); map.put ("Konstantinov","ff"); map.put ("IvanovVasilev", "Ivan"); map.put ("IvanovKonstantinov", "Kolya"); map.put ("Kolkin", "Kolya"); map.put ("IvanovTemkin", "Tema"); map.put ("IvanovIvanov", "Maks"); map.put ("Temkin", "Tema"); map.put ("IvanovIvanovIvanov", "Petya"); for (String key: map.keySet()) { } return map; } public static void removeFirstNameDuplicates(Map<String, String> map) { //write your code here HashMap<String, String> copy = new HashMap<String,String>(); HashMap<String, String> resultValue = new HashMap<String,String>(); for(Map.Entry<String, String> m2 : map.entrySet()) { copy.put(m2.getValue(),m2.getKey()); } for(Map.Entry<String, String> m3 : copy.entrySet()) { String myKey= m3.getValue(); String myValue = m3.getKey(); resultValue.put(myKey, myValue); //System.out.println(copy.getKey() + " "+ m3.getValue()); } for(Map.Entry<String, String> m3 : resultValue.entrySet()) { System.out.println(m3.getKey() + " "+ m3.getValue()); } removeItemFromMapByValue(resultValue,"Tem"); } 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 : map.entrySet()) { if (pair.getValue().contentEquals(value)) map.remove(pair.getKey()); } } public static void main(String[] args) { } }