Anyone know if there is a Promise.all() equivalent...
# coroutines
d
Anyone know if there is a Promise.all() equivalent for
Deferred<T>
?
l
d
ahhh makes sense
I was getting confused because I was trying to do it from a non suspending function
but I guess I can put that map call inside an
async
call
sorry I'm literally just learning about coroutines properly now, but thanks!
l
@Daniel Tam I guess the most efficient way is to do:
Copy code
arrayOf(
    async(coroutineContext) { ... },
    async(coroutineContext) { ... },
    async(coroutineContext) { ... }
).map { it.await() }
👍 2
d
a forEach makes more sense actually right
l
@Daniel Tam You're right. If you don't need a list of the results, a
forEach
on an array is even more efficient