码迷,mamicode.com
首页 > 其他好文 > 详细

遍历Map集合

时间:2017-07-18 15:30:00      阅读:144      评论:0      收藏:0      [点我收藏+]

标签:hashmap   while   map   string   bsp   腾讯   new   nbsp   try   

HashMap<String, String> map = new HashMap<String, String>();
        map.put("京东", "刘强东");
        map.put("腾讯", "马化腾");
        Set<Map.Entry<String, String>> entrySet = map.entrySet();
        Iterator<Map.Entry<String, String>> iterator = entrySet.iterator();
        while (iterator.hasNext()) {
            Map.Entry<String, String> entry = iterator.next();
            System.out.println("主键:" + entry.getKey() + ",值:" + entry.getValue());
        }

 

遍历Map集合

标签:hashmap   while   map   string   bsp   腾讯   new   nbsp   try   

原文地址:http://www.cnblogs.com/mrelk/p/7200278.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!