Transform a Future into CompletableFuture

Transforming a plain future into a CompletableFuture using a scheduler

It’s 2024. Completable futures have been introduced over 10 years ago in Java 8, and virtual threads – from Java 21 – have the potential to remove the need for futures altogether. Despite this, many external libraries still return a plain java.util.concurrent.Future, and will never update. Additionally, meaningful adoption of Java +21 might take years … Read more

Java’s CompletableFuture vs. Future

On the standard library, Java has many “futures”: All these live within package java.util.concurrent. In this post, we focus on CompletableFuture, and its relation to Future. If you want to know more about CompletableFuture, namely what it is, and how to use it, there is a practical guide at A Guide to CompletableFuture. For contextualisation, … Read more

CompletableFuture runAsync & supplyAsync

As explained in greater detail in A Guide to CompletableFuture there are 4 ways to create a CompletableFuture: Here we analyse runAsync and supplyAsync in detail, giving some practical examples. These two methods are the most used by programmers on day-to-day. These methods are static on class CompletableFuture, so you don’t need to have a … Read more

A Guide to CompletableFuture

Completable Future States

Overview This is an in-depth practical guide on how to use Java’s CompletableFuture. It is comprehensive and will serve you as a reference for when you have to work with them. It provides unique insights into how they operate, which you won’t easily find in other blogs and books. This will help you develop a … Read more

Index