thenCombine

The CompletableFuture method that waits for two independent stages and combines their results with a function.

In more detail

It lets two slow tasks run at the same time and joins them when both are done, instead of running them one after the other. If either input fails, the combined stage fails too.

Example

price.thenCombine(stock, (p, s) -> new Offer(p, s))

Related terms

Taught in

References