Map<Long, String> map = new HashMap<Long, String>();
map.put(1L, "ABC");
map.put(2L, "KK");
map.put(3L, "LV");
map.forEach((k,v)->{System.out.println(k + " = " + v);});
map.forEach((k,v)->System.out.println(k + " = " + v));
结果:
1 = ABC
2 = KK
3 = LV