What will be the output of the following code? -------------------- public static void main(String[] args) { List<Integer> list = Arrays.asList(1, 2, 3, 4, 5, 6, 7, 8, 9); int sum = list.stream().filter(n -> n % 2 == 1).mapToInt(Integer::intValue).sum(); System.out.println(sum); }
Geekific
What will be the output of the following code?
--------------------
public static void main(String[] args) {
List<Integer> list = Arrays.asList(1, 2, 3, 4, 5, 6, 7, 8, 9);
int sum = list.stream().filter(n -> n % 2 == 1).mapToInt(Integer::intValue).sum();
System.out.println(sum);
}
1 month ago | [YT] | 2