java8流的filter方法
转载https://blog.csdn.net/qq_20009015/article/details/84891638
List<Integer> evens = new ArrayList<>();
for (final Integer num : nums) {
if (num % 2 == 0) {
evens.add(num);
}
}
List<Integer> evens=num.stream().filter(num->num%2==0).collect(Collectors.toList());