Given the code fragment:
UnaryOperator<Integer> uo1 = s -> s*2; line n1
List<Double> loanValues = Arrays.asList(1000.0, 2000.0);
loanValues.stream()
.filter(lv -> lv >= 1500)
.map(lv -> uo1.apply(lv))
.forEach(s -> System.out.print(s + “ “));
What is the result?
A.
4000.0
B.
4000
C.
A compilation error occurs at line n1.
D.
A compilation error occurs at line n2.
D.
But there is no line n2.
The line “.map(lv -> uo1.apply(lv))” should be line n2.
D.
A compilation error occurs at line n2.
and suppose line n2 is .map(…..
D
map(lv->uo1.apply(lv)) //line n2
fails to compile because the method apply(Integer) is not applicable for the argument (Double)