What will be the output of the following code? -------------------- public static void main(String[] args) { List<Integer> list = Arrays.asList(3, 1, 4, 1, 5, 9); int result = list.stream().sorted() .collect(Collectors.collectingAndThen( Collectors.toList(), l -> l.get(3)) ); System.out.println(result); }
Geekific
What will be the output of the following code?
--------------------
public static void main(String[] args) {
List<Integer> list = Arrays.asList(3, 1, 4, 1, 5, 9);
int result = list.stream().sorted()
.collect(Collectors.collectingAndThen(
Collectors.toList(), l -> l.get(3))
);
System.out.println(result);
}
1 month ago | [YT] | 4