0
I have a list of strings, where I convert to a Flux. And, for each Flux, I perform a flatMap which, in turn, returns a list. Further ahead I run a collectList()
which converts Flux to a list. As a result within the map I have a List<List<String>>
, but what I really want is a List. However, I could not accomplish the flatten
of this guy, and having only one List<String>
with all values within.
fun getAllValues() {
var values: List<String> = listOf("value 1", "value 2")
values
.toFlux()
.flatMap { findMoreValues() }
.collectList()
.map { /* Aqui possuo um List<List<String>> */ }
}
fun findMoreValues(): List<String> {
callExternalApi() // retorna por exemplo listOf("value 3", "value 4")
}