CompletableFuture
Callbacks and Chaining
thenAccept()
: If We want to run some code after receiving some value from FuturethenApply()
: If We want to run some code after receiving value from Future and then want to return some valuethenRun()
: If We want to run some code after completion of the Future and dont want to return any value
allOf
The CompletableFuture.allOf
static method allows to wait for completion of all of the Futures
Exception Handling
exceptionally
handle
whenComplete
Tests
CompletableFutureSimpleTest
CompletableFutureThenApplyTest
CompletableFutureThenComposeTest
CompletableFutureExceptionTest
CompletableFutureExample
CompletableFutureTest