Asynchronous CompletableFuture San Francisco Adventure Java Challenge

completable future

The Completable Future feature is powerful to run asynchronous methods for better performance. In Java 5 there is the Future interface, however, the Future interface doesn’t have many methods that would help us to create robust code. To solve the limitations from the Future interface, we have the CompletableFuture API with methods that will help us to build reliable high-performant software.

Now that we had the intro about CompletableFuture, let’s go to the Java Challenge!

It's time to improve your Java skills with this Completable Future San Francisco Adventure

Completable Future San Francisco Adventure


In the following code, we are using a CompletableFuture invoking the completeAsync and thenAccept methods to perform actions asynchronously. 

Can you guess what will happen when running the following code?


If you want to watch the video explanation, check it out (But I recommend trying out the Java Challenge first):

That’s it challenger, rock on! Keep taking action and relentlessly break your limits! Don’t hesitate to leave a comment with a question if anything is not clear!

Written by
Rafael del Nero
Join the discussion

Stand Out as a Java Developer and Get Your Dream Job!

You will get the book by email in a few minutes after registering.