1. forEach and Map
1.1 通常这样遍历一个Map

Map items = new HashMap<>();
items.put("A", 10);
items.put("B", 20);
items.put("C", 30);
items.put("D", 40);
items.put("E", 50);
items.put("F", 60);
for (Map.Entry entry : items.entrySet()) {
System.out.println("Item : " + entry.getKey() + " Count : " + entry.getValue());
}

1.2 在java8中你可以使用 foreach + 拉姆达表达式遍历















