CompletableFuture -> Deferred


I have to use a Java lib (ArangoDB async driver) with methods returning CompletableFuture instances.

I’m creating a façade and I’d like to avoid exposing CompletableFuture. Instead, I want to expose Deferred instances.

My first attempt looks like this:

fun find(id: String): Deferred = async {
val document: CompletableFuture = collection.getDocument(id, c)

Is there a better way to do this?



That’s great! When should it be available in Maven repos ?