如何遍历HashMap集合类

Map map = new HashMap();
  map.put("a", "1");
  map.put("b", "2");
  map.put("c", "3");
  map.put("d", "4");
  map.put("e", "5");
  for (Iterator iter = map.keySet().iterator(); iter.hasNext();) {
      Object key = iter.next();
      Object val = map.get(key);
      System.out.println("key:"+key);
      System.out.println("value:"+val);
  }

原文地址:https://www.cnblogs.com/freezhan/p/3219056.html