I have two flows like this: flow_a{List(a,b,c)}, flow_b(list(1,2,3))
when I merger{flow_a, flow_b}, it war returned [list1,list2]
How I can return one list like this: [a,b,c,1,2,3]
thanks a lot for your help
CodePudding user response:
You can use function like zip to combine the flows.
Flow1.zip(Flow2).collect{}
CodePudding user response:
Use zip
but concatenate the lists together instead of using the default behavior of creating a pair.
val combinedFlow =
flowA.zip(flowB) { listA, listB -> listA listB }