What is CompletableFuture’s equivalent of flatMap?
There’s a bug in its documentation, but the CompletableFuture#thenCompose family of methods is the equivalent of a flatMap. Its declaration should also give you some clues public <U> CompletableFuture<U> thenCompose(Function<? super T,? extends CompletionStage<U>> fn) thenCompose takes the result of the receiver CompletableFuture (call it 1) and passes it to the Function you provide, which … Read more