Given the code fragment:
UnaryOperator
List
loanValues.stream()
.filter(lv -> lv >= 1500)
.map(lv -> uo1.apply(lv)) //line n2
.forEach(s -> System.out.print(s + " "));
What is the result?
Given the code fragment:
UnaryOperator
List
loanValues.stream()
.filter(lv -> lv >= 1500)
.map(lv -> uo1.apply(lv)) //line n2
.forEach(s -> System.out.print(s + " "));
What is the result?
The code snippet iterates over a list of loan values, filtering out values less than 1500 and then applying a unary operator that doubles each remaining value. The loan value of 2000.0 remains after filtering, and doubling it results in 4000.0. This value is printed out, resulting in the output '4000.0'. Therefore, 4000.0 is the correct result.
A is the correct answer-tested
A,tested
D is the correct answer tested. if at line 2 map(lv -> uo1.apply(lv.intValue())) then 4000
Sorry A 4000.0 is the correct answer
A is correct.
A is correct, tested 22/09/2023