https://kotlinlang.org logo
#coroutines
Title
# coroutines
c

christophsturm

12/13/2020, 10:15 AM
What’s the most idiomatic way to transform a flow with multiple threads? Let’s say I have a flow that contains suspend lambdas and I want to transform it to a flow that contains the result of those lambdas, but do it with 16 threads. I know how I would do it with channels, but aber flows more suitable?
c

christophsturm

12/13/2020, 11:58 AM
thanks! does that mean for now I best use a channel?
o

okarm

12/13/2020, 1:52 PM
I’m curious, is there an explicit reason why you’re apprehensive about channels?
g

gildor

12/13/2020, 1:58 PM
You can use flatMap instead, which maps over multiple concurrent flows
c

christophsturm

12/13/2020, 3:13 PM
I’m not apprehensive about channels, I just thought maybe theres a way to do it with flows that I don’t know about.
basically just like the example from the github issue.
2 Views