почему в методе getCountTheSameFirstName тип данных у entry.getValue() - Object, а не String?
public class Solution {
    public static HashMap<String, String> createMap() {
        HashMap<String, String> map = new HashMap<>();
        for (int i = 0; i < 10; i++) {
            map.put("qwe", "qwer");
            map.put("wer", "qwer");
            map.put("ert", "rty");
            map.put("rty", "qaz");
            map.put("tyu", "wsx");
            map.put("yui", "wsx");
            map.put("uio", "wsx");
            map.put("iop", "edc");
            map.put("asd", "wsx");
            map.put("sdf", "qwer");
        }
        return map;
    }

    public static int getCountTheSameFirstName(HashMap<String, String> map, String name) {
        int count = 0;
        for (HashMap.Entry entry : map.entrySet()) {
            Object value = entry.getValue();            // вот здесь не пропустило тип String для value
            if (value.equals(name)) {
                count++;
            }
        }
               return count;
    }

    public static int getCountTheSameLastName(HashMap<String, String> map, String lastName) {
        if (map.containsKey(lastName))
            return 1;
        else return 0;
    }

    public static void main(String[] args) {
        HashMap x = createMap();
        getCountTheSameFirstName(x, "wsx");
        getCountTheSameLastName(x, "qwe");
    }
}