我正在HashMap
像这样插入值
String group_name[]=group_names.split(",");
String group_ids[]=new_groups.split(",");
Hashtable<Integer,String> hm=new Hashtable<Integer,String>(10);
for(int i=0;i<group_ids.length;i++){
if (group_ids[i]!=null && !group_ids.equals("")) {
hm.put(Integer.parseInt(group_ids[i]), group_name[i]);
}
在下面的代码中,list2 是ArrayList
它的键,HashMap
我正在检索如下值
for(String group_id1:list2) {
int gid=Integer.parseInt(group_id1);
String group_name=hm.get(Integer.parseInt(group_id1));
这里 hm.get() 方法返回 null