Map值如下
Map<String,Object> map = new HashMap<>();
map.put("key1","value1");
map.put("key2","value2");
map.put("key3","value3");
1、在已知鍵值得情況下獲取Map中的值
Object value1 = map.get("key1");
Object value2 = map.get("key2");
Object value3 = map.get("key3")
2、在未知鍵值的情況下獲取Map的值
map.entrySet()
Set<Entry<String,Object>> entry = map.entrySet();
for(Entry<String,Object> value:entry){
value.getValue();
map.keySet()
for(String key:map.keySet()){
map.get(key);
Map值如下
Map<String,Object> map = new HashMap<>();
map.put("key1","value1");
map.put("key2","value2");
map.put("key3","value3");
1、在已知鍵值得情況下獲取Map中的值
Object value1 = map.get("key1");
Object value2 = map.get("key2");
Object value3 = map.get("key3")
2、在未知鍵值的情況下獲取Map的值
map.entrySet()
Set<Entry<String,Object>> entry = map.entrySet();
for(Entry<String,Object> value:entry){
value.getValue();
map.keySet()
for(String key:map.keySet()){
map.get(key);