`future {}` doesn’t return a deferred. It returns ...
# coroutines
k
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:
Copy code
suspend fun awaitingFuture(block: () -> Unit) = future(block).await()
@rogeralsing here
But this is what
run
is meant for
r
and to be idiomatic, I should use the newer CompletableFuture in my Java API, not Future?
k
Well. CompleteableFuture is only available Java8+. if it fits into your use case, then you should be good