遍历HashMap

java.util.Iterator it = hashmap.entrySet().iterator();
while(it.hasNext()){
java.util.Map.Entry entry = (java.util.Map.Entry)it.next();
 entry.getKey(); //返回与此项对应的键

 entry.getValue(); //返回与此项对应的值

}

你可能感兴趣的:(HashMap)