标签:ash span int try div col pre lambda entry
Map<String, Object> map = new HashMap<>(); map.put("name", "张三"); map.put("age", 20); for (String key : map.keySet()) { String value = map.get(key).toString(); System.out.println(key); System.out.println(value); }
Map<String, Object> map = new HashMap<>(); map.put("name", "张三"); map.put("age", 20); Set<Map.Entry<String, Object>> entries = map.entrySet(); for (Map.Entry<String, Object> entry : entries){ System.out.println(entry.getKey()); System.out.println(entry.getValue()); }
Map<String, Object> map = new HashMap<>(); map.put("name", "张三"); map.put("age", 20); Set<Map.Entry<String, Object>> entries = map.entrySet(); entries.forEach(entry -> System.out.println(entry.getKey() + "=" + entry.getValue()));
Map<String, Object> map = new HashMap<>(); map.put("name", "张三"); map.put("age", 20); map.forEach((key, value) -> System.out.println(key + "=" + value));
标签:ash span int try div col pre lambda entry
原文地址:https://www.cnblogs.com/osmoba/p/14943289.html