1.Stream可以对过滤进行优化:1>list.stream().filter(name->name.startsWith("a"))
.filter(name->name.length()==3)
.foreach(name->System.out.println(name));//两次过滤一次输出;
2>获取流:Collection集合/static of方式:
3>for each方法:
4>filter方法:Stream<String> stream2 =stream
1.Stream可以对过滤进行优化:1>list.stream().filter(name->name.startsWith("a"))
.filter(name->name.length()==3)
.foreach(name->System.out.println(name));//两次过滤一次输出;
2>获取流:Collection集合/static of方式:
3>for each方法:
4>filter方法:Stream<String> stream2 =stream