Here you can find the source of convertFuture(Future
public static <V> CompletableFuture<V> convertFuture(Future<V> future)
//package com.java2s; //License from project: Apache License import java.util.concurrent.CompletableFuture; import java.util.concurrent.Future; import static java.util.concurrent.CompletableFuture.supplyAsync; public class Main { public static <V> CompletableFuture<V> convertFuture(Future<V> future) { CompletableFuture<V> brighterFuture = supplyAsync(() -> { try { return future.get(); } catch (Exception e1) { throw new RuntimeException(e1); }/*from w w w.j a v a 2 s . c o m*/ }); return brighterFuture; } }