<How to find first desired result from kotlin coro...
# stackoverflow
u
How to find first desired result from kotlin coroutines Deferred&lt;&gt; (server) I’ve built a sharding library and i’m trying to add coroutine functionality to it. In the following snippet it returns the first true result that it finds: override fun emailExists(email: String): Boolean { return runBlocking { shards .asyncAll { userDao.emailExists(email) } .map { it.await() } .firstOrNull { it } } ?: false } the shards.asyncAll method is: fun async( shardId: Long, context: CoroutineContext =...