The CompletableFuture API overview

The CompletableFuture API consists of more than 70 methods, 38 of which are implementations of the CompletionStage interface, and five are the implementations of Future. Because the CompletableFuture class implements the Future interface, it can be treated as Future and will not break the existing functionality based on the Future API.

So, the bulk of the API comes from CompletionStage. Most of the methods return CompletableFuture (in the CompletionStage interface, they return CompletionStage, but they are converted to CompletableFuture when implemented in CompletableFuture class), which means that they allow chaining the operations similar to how the Stream methods do when only one element goes through ...

Get Java 9 High Performance now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.