Java Stream API
Stream, Lambda and functional interfaces
Question 1 of 7
Question 1 of 7java
What does the following code output? List<Integer> nums = List.of(1,2,3,4); int sum = nums.stream().filter(n -> n % 2 == 0).mapToInt(n -> n).sum(); System.out.println(sum);
java
List<Integer> nums = List.of(1,2,3,4);
int sum = nums.stream().filter(n -> n % 2 == 0).mapToInt(n -> n).sum();
System.out.println(sum);