简体   繁体   中英

Spring Webflux Flux<List<MyPojo>> to Flux<MyPojo>

Small question regarding how to convert a Flux<List> to Flux in Spring Webflux.

I tried some combinations of reduce and flat map, but not getting the Flux.

If it is possible, what would be the correct way to get a Flux from Flux<List> please?

Many thanks.

You can use flatMapIterable :

Flux<List<MyPojo>> myFlux = ...
myFlux.flatMapIterable(p -> p).map(myPojo -> ...)

See the documentation for flatMapIterable here .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM