HashMap的遍历

    /**
      * HashMap的遍历建议entryset来进行遍历

* Description:[方法功能中文描述] *

* * Created by [Administrator] [2019年3月1日] * Midified by [修改人] [修改时间] */ public void testMapKeyVal() { Map map = new HashMap(); Iterator iter = map.entrySet().iterator(); while (iter.hasNext()) { Map.Entry entry = (Map.Entry) iter.next(); Object key = entry.getKey(); Object val = entry.getValue(); System.out.println("key:"+key +"-----value:"+val); } }

 

你可能感兴趣的:(java)