https://kotlinlang.org logo
Title
a

Alex Mihailov

06/29/2021, 2:54 PM
Hello everyone! Please tell me, the
whenReady
extension function for
CompletableFuture
has been removed? What is the alternative ?
s

sam

06/29/2021, 3:06 PM
You can use the built in coroutines adapter to use it as a suspendable
a

Alex Mihailov

06/29/2021, 3:11 PM
I have two cases - using coroutines and using Java Future. I wanted to use
whenReady
when testing Java Future. But apparently it will not work. Thanks for the advice!
s

sam

06/29/2021, 3:22 PM
the problem with the standard Future is there's no method other than .get() which is blocking
so something has to block somewhere
the completable future has the callback that coroutines can hook into