Rob
01/07/2021, 2:36 PMList<Flow<T>>? Something that would have this signature (List<Flow<T>>) -> Flow<List<T>>? I’m updating a RecyclerView using AsyncListDiffer.submitIList().tateisu
01/07/2021, 2:52 PMRob
01/07/2021, 2:52 PMRob
01/07/2021, 3:06 PMMiSikora
01/07/2021, 3:29 PMinternal fun <T> Iterable<Flow<T>>.combineLatest(): Flow<List<T>> {
val emptyFlow = emptyFlow<List<T>>()
return fold(emptyFlow) { xs, x ->
if (xs === emptyFlow) {
x.map(::listOf)
} else {
xs.combine(x) { a, b -> a + b }
}
}
}Rob
01/07/2021, 4:07 PMMiSikora
01/07/2021, 4:21 PMRob
01/07/2021, 4:42 PMRob
01/07/2021, 4:42 PMDominaezzz
01/07/2021, 4:55 PMcombine(....) {...}.Rob
01/07/2021, 6:55 PMRob
01/07/2021, 7:27 PMDominaezzz
01/07/2021, 8:09 PMfun <T> Iterable<Flow<T>>.combineLatest(): Flow<List<T>> = combine(this) { it.toList() }MiSikora
01/08/2021, 3:45 PM