Java Completable Futures

Running in parallel

import java.util.concurrent.CompletableFuture;

CompletableFuture<String> future1 = CompletableFuture.supplyAsync(() -> "Hello");
CompletableFuture<String> future2 = CompletableFuture.supplyAsync(() -> "Beautiful");
CompletableFuture<String> future3 = CompletableFuture.supplyAsync(() -> "World");

CompletableFuture<Void> combinedFuture = CompletableFuture.allOf(future1, future2, future3);

CompletableFuture<String> result = combinedFuture.thenApply(v -> future1.join() + future2.join() + future3.join());

System.out.println(result.get());
HelloBeautifulWorld