【笔记】遍历Map的方法

来源:互联网 发布:在线商标设计软件 编辑:程序博客网 时间:2024/06/06 15:44

mapA为HashMap<String, String>


Set entrySet = mapA.entrySet();
int i=0; for(Iterator iter = entrySet.iterator(); iter.next);{   i++;   Map.Entry entry = iter.next();   System.out.println("the "+i+"th key is"entry.getKey());   System.out.println("the "+i+"th value is"entry.getValue());}

原创粉丝点击