- Hands-On Reactive Programming with Reactor
- Rahul Sharma
- 137字
- 2021-08-13 15:22:56
The Flux.from methods
The From methods can be used to generate a Flux from various sources, such as arrays, collections, and so on. In this case, all of the values are identified as multi-valued datasets beforehand. The generated Flux publishes the value events for each value in the original dataset, followed by a completion event. The offered methods have the following variants:
- Flux.fromArray: This is used to build a stream from an array of a type.
- Flux.fromIterable: This is used to build a stream from collections. All collections are of the Iterable<T> type, which can be passed to this to generate the intended stream.
- Flux.fromStream: This is used to build a Flux from an existing Java 8 stream or a Java 8 stream supplier. Consider the following code:
Flux.fromArray(new Integer[]{1,1,2,3,5,8,13});
Flux.fromIterable(Arrays.asList("Red", "Blue", "Yellow", "Black"));
Flux.fromStream(IntStream.range(1,100).boxed());
推薦閱讀
- 工業(yè)機器人技術(shù)及應用
- 空間機器人遙操作系統(tǒng)及控制
- AWS:Security Best Practices on AWS
- 教父母學會上網(wǎng)
- 最簡數(shù)據(jù)挖掘
- RPA:流程自動化引領(lǐng)數(shù)字勞動力革命
- CentOS 8 Essentials
- Prometheus監(jiān)控實戰(zhàn)
- SQL Server數(shù)據(jù)庫應用基礎(chǔ)(第2版)
- IBM? SmartCloud? Essentials
- Cloudera Hadoop大數(shù)據(jù)平臺實戰(zhàn)指南
- PostgreSQL High Performance Cookbook
- 從祖先到算法:加速進化的人類文化
- Mastering SQL Server 2014 Data Mining
- 多媒體技術(shù)應用教程