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)
document.await()
}
Is there a better way to do this?