记录一下Lambda表达式,不多说对比就完事了
以前的forEach():
List<String> list = Arrays.asList("a","b","c","d");
以前的forEach
for (String str: list) {
System.out.println(str);
}
现在的forEach():
第一种:
list.forEach(x->{
System.out.println(x);
});
第二种:
list.forEach(x->System.out.println(x));