1.遍历key-Value
ConcurrentHashMap<String, Object> map= new ConcurrentHashMap<String, Object>();//Object替换为结构类 for(String key :map.keySet()){ Object object= map.get(key); }
2.遍历Value
ConcurrentHashMap<String, Object> map= new ConcurrentHashMap<String, Object>();//Object替换为结构类 Iterator<Entry<String, Object>> it = map.entrySet().iterator(); while (it.hasNext()) { Entry<String, Object> entry = (Entry<String, Object>) it.next(); Object object= entry.getValue(); }