rrva
10/15/2017, 11:47 PMfun asyncFetchFoo(id: String) = async { ... }
which returns a Deferred<String>
What is a clean way to invoke the fetching concurrently and still map each result back to the corresponding id
without intermediate maps?
If I have:
val ids = listOf("a","b","c","d")
val linksById = ids.associateBy({ it.id },{asyncFetchFoo(it.id)})
val results = ids.map { it + "=" + linksById[it].await() }
What is a clean pattern to avoid the linksById
map and still invoke asyncFetchFoo concurrently?