Reputation: 549
Please help to understand how can I use fkatMap() in my example:
Flux.just("1,2,3", "4,5,6")
.flatMap(// to do something)
.collect(Collectors.toList())
.subscribe(System.out::println);
I read the documentation. I understood how to work flatMap() but I can't understand how I need to use in my example. Thanks.
Upvotes: 0
Views: 387
Reputation: 1181
As Kayaman already answered, you can do the following:
Flux.just("1,2,3", "4,5,6")
.flatMap(i -> Flux.fromIterable(Arrays.asList(i.split(","))))
.collect(Collectors.toList())
.subscribe(System.out::println);
Upvotes: 1