HashMap遍历

来源:互联网 发布:传智大数据100g百度云 编辑:程序博客网 时间:2024/06/03 23:35
    HashMap< Integer, Integer> hashMap=new HashMap<>();hashMap.put(2, 3);hashMap.put(5,6);Iterator  iterator=hashMap.entrySet().iterator();while (iterator.hasNext()) {    HashMap.Entry entry =  (Entry) iterator.next();    int a=(int) entry.getKey();    int b=(int) entry.getValue();    System.out.println(a+"  "+b);}
0 0
原创粉丝点击