I have gone over it several times and compared the code with other's but I cannot see why the third condition won't verify.
Please help.
package com.codegym.task.task08.task0815;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
/*
Census
*/
public class Solution {
public static HashMap<String, String> createMap() {
HashMap <String, String> map = new HashMap <String, String>();
map.put("Lo", "Ga");
map.put("Lo", "Ga");
map.put("Bo", "Ca");
map.put("Bo", "Ca");
map.put("Do", "Ea");
map.put("Do", "Ea");
map.put("Ro", "Fa");
map.put("Ro", "Fa");
map.put("To", "Wa");
map.put("To", "Wa");
return map;//write your code here
}
public static int getSameFirstNameCount(HashMap<String, String> map, String name) {
int countA=0;
for (Map.Entry<String, String> pair : map.entrySet()){
String firstname = pair.getValue();
if (firstname.equals(name))
countA++;
}
return countA;//write your code here
}
public static int getSameLastNameCount(HashMap<String, String> map, String lastName) {
int countB=0;
for (Map.Entry<String, String> pair : map.entrySet()){
String lastname = pair.getKey();
if (lastname.equals(lastName))
countB++;
}
return countB;//write your code here
}
public static void main(String[] args) {
}
}