Question 19
Back to Exercise
Given Function<Integer, Function<Integer, Integer>> add = a -> b -> a + b;, how do you compute 2 + 3?
- A add.apply(2, 3)
- B add.apply(2).apply(3) Correct
- C add(2)(3)
- D add.apply(3).get(2)
Correct Answer: Option B
add.apply(2) returns a function that adds 2.
Discussion & Comments 0
Share your method, a shortcut, or ask about a step you didn't follow.
No comments yet. Be the first to share your solution!