map的遍历
工作中常见的几种map的遍历
Map<String, String> map = new HashMap<>();
map.put("1","A");
map.put("2","B");
map.entrySet().forEach(m->{
String key = m.getKey();
String value = m.getValue();
})
map.forEach((k,v)->{
System.out.println(k);
System.out.println(v);
});
for(Map.Entry<String, String> entry : map.entrySet()) {
String key = entry.getKey();
String value = entry.getValue();
}