Question 9
Back to Exercise
When should thenCompose be used instead of thenApply?
- A Never
- B When the next step itself returns a CompletableFuture, to avoid a nested CompletableFuture<CompletableFuture<T>> Correct
- C When combining two independent futures
- D When handling errors
Correct Answer: Option B
thenCompose is like flatMap; thenCombine joins two independent futures.
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!