如何转换Mono< List< String>>进入Flux< String> [英] How to convert Mono<List<String>> into Flux<String>

查看:103
本文介绍了如何转换Mono< List< String>>进入Flux< String>的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在将用RxJava 1.x编写的小项目转换为Reactor3.x.一切都很好,除了我找不到如何用适当的替代品替换 flatMap(Observable :: from)之外.我有 Mono< List< String>> ,我需要将其转换为 Flux< String> .

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>.

推荐答案

在Reactor 3中, from 运算符已根据原始来源(数组,可迭代等)专门化为几个变体....).

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

在您的情况下使用 yourMono.flatMapMany(Flux :: fromIterable).

这篇关于如何转换Mono&lt; List&lt; String&gt;&gt;进入Flux&lt; String&gt;的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆