I've the following working piece of code using CompleteableFuture:
CompletableFuture<SomeObject> future = CompletableFuture.
supplyAsync( () -> f1() ).
thenApplyAsync( f1Output -> f2( f1Output ) ).
thenApplyAsync( f2Output -> f3( f2Output ) );
Is it possible to run another future that receives f1Output as an input? Something like:
CompletableFuture<SomeObject> future = CompletableFuture.
supplyAsync( () -> f1() ).
thenApplyAsync( f1Output -> f2( f1Output ) ).
someApiThatRuns( f1Output -> f4( f1Output ) ). // <--
thenApplyAsync( f2Output -> f3( f2Output ) );
If this simplifies things one can ignore the result returned by f4().