Quiz · Lambdas and the Stream API · lesson 10 of 12
Quiz — a stream with no terminal operation
What does the program print?
import java.util.List;
public class Main {
public static void main(String[] args) {
List<Integer> xs = List.of(1, 2, 3);
xs.stream().map(x -> {
System.out.print(x + " ");
return x * 2;
});
System.out.println("end");
}
}