添加:
Map<String,String> map=new HashMap<>();
map.put(key,value)
map.put("name","zql")
獲取
map.get("name")
刪除
map.remove(key)
遍歷
for(String key:map.keyset()){
sout(map.get(key))
}
for(String value:map.values()){
sout(value);
}
for(Map.Entry<String,String> entry:map.entrySet()){
sout(entry.getValue());
sout(entry.getKey());
}
判斷是否有key
map.containsKey(key);
map.get(key)==null