this is the error message: " Check the createMap() method. The HashMap should consist of 10 entries that represent (last name, first name) pairs."
i counted it 10 times now and it is 10 of them values why won't it count 10 then? Any ideas??
package com.codegym.task.task08.task0815;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
/*
Census
*/
public class Solution {
public static HashMap<String, String> createMap() {
HashMap<String, String> map = new HashMap<String, String>();
map.put("Coll", "John");
map.put("Coll", "Anne");
map.put("Sane", "John");
map.put("Paine", "Mary");
map.put("Nosy", "Casey");
map.put("Noisy", "Anne");
map.put("Paine", "Mary");
map.put("Crane", "Lois");
map.put("Lane", "Lewis");
map.put("Somer", "Ashley");
return map;
}
public static int getSameFirstNameCount(HashMap<String, String> map, String name) {
int fcount = 0;
for(HashMap.Entry<String, String> pair: map.entrySet()){
if(name.contains(pair.getValue())){
fcount++;
}
}
return fcount;
}
public static int getSameLastNameCount(HashMap<String, String> map, String lastName) {
int lcount = 0;
for(HashMap.Entry<String, String> pair: map.entrySet()){
if(lastName.contains(pair.getKey())){
lcount++;
}
}
return lcount;
}
public static void main(String[] args) {
}
}