public static String getCityId(HashMap<String,String> citys, String city){
Set set = citys.entrySet();//新建一个不可重复的集合
ArrayList<String> arr = new ArrayList<String>();//新建一个集合
Iterator it = set.iterator();//遍历的类
while(it.hasNext()) {
Map.Entry entry = (Map.Entry)it.next();//找到所有key-value对集合
if(entry.getValue().equals(city)) {//通过判断是否有该value值
String s = (String) entry.getKey();//取得key值
arr.add(s);
}
}
return arr.get(0);
}