O'Reilly logo

Mastering Java 11 - Second Edition by Dr. Edward Lavieri

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Class details

The CompletableFuture<T> class has one nested class that marks asynchronous tasks:

public static interface CompletableFuture.AsynchronousCompletionTask

The constructor for the CompletableFuture<T> class has to be in sync with the provided constructor signature. It also must not take any arguments. The class has the following methods, which are organized by what they return:

Returns CompletionStage:

  • public CompletableFuture<Void> acceptEither(CompletionStage<? extends T> other, Consumer<? super T> action)
  • public CompletableFuture<Void> acceptEitherAsync(CompletionStage<? extends T> other, Consumer<? super T> action)
  • public CompletableFuture<Void> acceptEitherAsync(CompletionStage<? extends T> other, Consumer<? super T> action, ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required