Reactor系列(七)flatMap映射
2019-12-17 18:22
1831 查看
【推荐】2019 Java 开发者跳槽指南.pdf(吐血整理) >>>
#java##reactor##flatMap#
视频讲解: https://www.bilibili.com/video/av79582009/
FluxMonoTestCase.java
package com.example.reactor; import lombok.extern.slf4j.Slf4j; import org.junit.jupiter.api.Test; import reactor.core.publisher.Flux; @Slf4j public class FluxMonoTestCase extends BaseTestCase { @Test public void flatMap(){ Flux<String> stringFlux1 = Flux.just("a","b","c","d","e","f","g","h","i"); //嵌套Flux Flux<Flux<String>> stringFlux2 = stringFlux1.window(2); stringFlux2.flatMap(flux1 ->flux1.map(word ->word.toUpperCase())) .subscribe(System.out::println); //从嵌套Flux还原字符串Flux Flux<String> stringFlux3 = stringFlux2.flatMap(flux1 ->flux1); // stringFlux1 等于 stringFlux3 stringFlux3.subscribe(System.out::println); } }
BaseTestCase.java
package com.example.reactor; import java.util.Arrays; import java.util.List; public class BaseTestCase { protected static final List<Employee> list = Arrays.asList( new Employee(1, "Alex", 1000), new Employee(2, "Michael", 2000), new Employee(3, "Jack", 1500), new Employee(4, "Owen", 1500), new Employee(5, "Denny", 2000)); }
关注公众号,坚持每天3分钟视频学习
相关文章推荐
- RxJava 系列之变换操作符flatmap(2)
- Spark RDD/Core 编程 API入门系列 之rdd案例(map、filter、flatMap、groupByKey、reduceByKey、join、cogroupy等)(四)
- 深入浅出Mybatis系列(八)---mapper映射文件配置之select、resultMap
- STL系列之map(映射)
- 框架学习系列 mybatis 第十八篇 高级结果一对一结果映射之resultMap的使用
- 深入浅出Mybatis系列(八)---mapper映射文件配置之select、resultMap
- scala编程系列(5)-scala集set和映射map
- 深入浅出Mybatis系列(八)---mapper映射文件配置之select、resultMap
- Spark RDD/Core 编程 API入门系列 之rdd案例(map、filter、flatMap、groupByKey、reduceByKey、join、cogroupy等)(四)
- Rx系列总结一:RxJava 中的map与flatMap
- 深入浅出Mybatis系列(八)---mapper映射文件配置之select、resultMap
- 好程序员大数据学习路线分享Scala系列之映射Map
- reactor3 flux的map与flatMap的区别
- PHP转Go系列:map映射
- 深入浅出Mybatis系列(八)---mapper映射文件配置之select、resultMap
- 深入浅出Mybatis系列(八)---mapper映射文件配置之select、resultMap
- 深入浅出Mybatis系列(八)---mapper映射文件配置之select、resultMap
- 深入浅出Mybatis系列(八)---mapper映射文件配置之select、resultMap
- 深入浅出Mybatis系列(八)---mapper映射文件配置之select、resultMap
- 深入浅出Mybatis系列(八)---mapper映射文件配置之select、resultMap