//1,取key Map<String,String> map=new HashMap<String,String>(); for(String key:map.keySet()){ map.get(key); } //2,取value Map<String,String> map=new HashMap<String,String>(); for(String value:map.values){ System.out.println("value = "+value); } //3,最常用 Map<String, String> map = new HashMap<String, String>(); for (Map.Entry<String, String> entry : map.entrySet()) { System.out.println("Key = " + entry.getKey() + ", Value = " + entry.getValue()); } //4,iterator Map<String, String> map = new HashMap<String, String>(); Iterator<Map.Entry<String, String>> entries = map.entrySet().iterator(); while (entries.hasNext()) { Map.Entry<String, String> entry = entries.next(); System.out.println("Key = " + entry.getKey() + ", Value = " + entry.getValue()); }