...

/

CompletableFuture: Processing Results

CompletableFuture: Processing Results

This lesson discusses, how to process the result of a CompletableFuture.

In the previous lesson, we looked at CompletableFuture. We discussed how to create a CompletableFuture object and how to run tasks asynchronously.

In this lesson, we will look at how to process the result of a CompletableFuture.

Processing the result of CompletableFuture

Suppose we have a CompletableFuture and we need to process the result of its execution. Now, the get() method of CompletableFuture is blocking. This means we need to wait until we get the result of the first task. After getting the result, we can modify the result.

For our system to be truly asynchronous we should be able to attach a callback to the CompletableFuture, which should be ...