Quiz · Lambdas and the Stream API · lesson 8 of 12
Quiz — filter and map
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, 4, 5);
List<Integer> r = xs.stream()
.filter(x -> x % 2 == 1)
.map(x -> x * 10)
.toList();
System.out.println(r);
}
}