HashMap的ContainKey()该方法调用返回true,如果此映射包含指定键的映射关系。
eg1:HashMap newmap = new HashMap();
newmap.put(1, "tutorials");
newmap.put(2, "point");
newmap.put(3, "is best");
System.out.println("Check if key 2 exists: " + newmap.containsKey(2));
eg2:for(GridMaking ele : list){
String eleType = ele.getElement();
if(resultMap.ContainKey(eleType)){
resultMap.get(eleType).add(ele);
}
}