遍历HashMap

来源:互联网 发布:在u盘里安装ubuntu 编辑:程序博客网 时间:2024/06/05 17:40
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(); //返回与此项对应的值

}