package zh.codegym.task.task08.task0815;
import java.util.HashMap;
import java.util.HashSet;
import java.util.ArrayList;
/*
人口普查
*/
public class Solution {
public static HashMap<String, String> createMap() {
//在此编写你的代码
HashMap<String,String> map=new HashMap<String,String>();
map.put("wu","kris");
map.put("PG","One");
map.put("王","德华");
map.put("陈","冠希");
map.put("德","一");
map.put("华","一");
map.put("成","龙");
map.put("张","国荣");
map.put("泰勒","彦祖");
map.put("吴","亦凡");
return map;
}
public static int getSameFirstNameCount(HashMap<String, String> map, String name) {
//在此编写你的代码
int rep=0;
for(String key:map.keySet())
{
if(name.equals(key))
{
rep++;
}
// System.out.println(key);
}
return rep;
}
public static int getSameLastNameCount(HashMap<String, String> map, String lastName) {
//在此编写你的代码
int rep=0;
for(String valuesp:map.values())
{
if(lastName.equals(valuesp))
{
rep++;
}
// System.out.println(key);
}
return rep;
}
public static void main(String[] args) {
}
}