Paul N
07/31/2019, 11:20 AMval output = mutableListOf<String>()
for (something in channel) {
if (some condition based on something) {
output.add(something)
}
}
Dominaezzz
07/31/2019, 11:37 AMList<Deferred<String>>
instead of a channel.val output = TODO("Call REST and make deferred list").awaitAll().filter { some condition based on something }
.Paul N
07/31/2019, 12:07 PMDominaezzz
07/31/2019, 12:08 PMdeferredList += async { }
as supposed to async { deferredList += this }
.ahulyk
07/31/2019, 2:37 PMFlow<String>
and filter{ }
it. You also can combine multiple calls using flatMapMerge
-> https://kotlin.github.io/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines.flow/flat-map-merge.htmlPaul N
08/05/2019, 8:12 AM