How to convert Mono<List<String>> into Flux<String>

Mavo :

I'm converting small project written in RxJava 1.x to Reactor 3.x. All is good, except that I could not find out how to replace flatMap(Observable::from) with an appropriate counterpart. I have Mono<List<String>> and I need to convert it to Flux<String>.

Simon Baslé :

In Reactor 3, the from operator has been specialized into a few variants, depending on the original source (array, iterable, etc...).

Use yourMono.flatMapMany(Flux::fromIterable) in your case.

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=446898&siteId=1