https://kotlinlang.org logo
Title
k

kingsley

07/27/2017, 9:05 PM
future {}
doesn’t return a deferred. It returns a standard
CompleteableFuture
and
await
is simply an extension function on top of it
But then you can always write a simple function to collapse all these into a single call. Something like:
suspend fun awaitingFuture(block: () -> Unit) = future(block).await()
@rogeralsing here
But this is what
run
is meant for
r

rogeralsing

07/27/2017, 9:20 PM
and to be idiomatic, I should use the newer CompletableFuture in my Java API, not Future?
k

kingsley

07/27/2017, 9:21 PM
Well. CompleteableFuture is only available Java8+. if it fits into your use case, then you should be good