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() {
//write your code here
HashMap<String, String> mapOfNames = new HashMap<>();
mapOfNames.put("Andrei", "Damigeana");
mapOfNames.put("Florin", "Damigeana");
mapOfNames.put("MIoara", "Geana");
mapOfNames.put("Victor", "Damigeana");
mapOfNames.put("Diana", "Brotac");
mapOfNames.put("Cristiana", "Brotac");
mapOfNames.put("Nelu", "Brotac");
mapOfNames.put("Camelia", "Brotac");
mapOfNames.put("Daniel", "Daniel");
mapOfNames.put("Damiana", "Damiana");
return mapOfNames;
}
public static int getSameFirstNameCount(HashMap<String, String> map, String name) {
//write your code here
int count =0;
for(Map.Entry<String,String> pair : map.entrySet()){
if(pair.getValue().equals(name)){
count++;
}
}
return count;
}
public static int getSameLastNameCount(HashMap<String, String> map, String lastName) {
//write your code here
int counter =0;
for(Map.Entry<String,String> pair : map.entrySet()){
if(pair.getValue().equals(lastName)){
counter++;
}
}
return counter;
}
public static void main(String[] args) {
}
}