CompletableFuture in Java

A Future represents the pending result of an asynchronous computation. It offers a method — get — that returns the result of the computation when it’s done.

The problem is that a call to get is blocking until the computation is done. This is quite restrictive and can quickly make the asynchronous computation pointless.

CompletableFuture<T> extends Future<T> and makes it completable in an ad hoc manner. This is a big deal, considering that Future objects were limited before Java 8. Continue reading “CompletableFuture in Java”