1.使用lambda表达式对集合进行迭代
/** * Lambda表达式遍历集合 */ @Test public void lambdaTest1(){ List<String> features = Arrays.asList("Lambdas", "Default Method", "Stream API", "Date and Time API"); //java8之前 for (String feature : features) { System.out.println(feature); } //java8之后 features.forEach(n->System.out.println(n)); //或 //C++里面的双冒号、范围解析操作符现在在Java 8中用来表示方法引用 features.forEach(System.out::println); }View Code
2.
标签:features,System,特性,feature,println,java8,out From: https://www.cnblogs.com/zhihuifan10/p/11126441.html