- Learning RxJava
- Thomas Nield
- 52字
- 2021-07-02 22:22:53
Observable.future()
RxJava Observables are much more robust and expressive than Futures, but if you have existing libraries that yield Futures, you can easily turn them into Observables via Observable.future():
import io.reactivex.Observable;
import java.util.concurrent.Future;
public class Launcher {
public static void main(String[] args) {
Future<String> futureValue = ...;
Observable.fromFuture(futureValue)
.map(String::length)
.subscribe(System.out::println);
}
}
推薦閱讀
- 程序員面試筆試寶典(第3版)
- R語言數(shù)據(jù)分析從入門到精通
- 微服務(wù)與事件驅(qū)動架構(gòu)
- Azure IoT Development Cookbook
- Interactive Data Visualization with Python
- Mastering QGIS
- Django開發(fā)從入門到實踐
- C語言程序設(shè)計立體化案例教程
- 基于Swift語言的iOS App 商業(yè)實戰(zhàn)教程
- Kotlin極簡教程
- JavaScript從入門到精通(視頻實戰(zhàn)版)
- C# 7.0本質(zhì)論
- HikariCP數(shù)據(jù)庫連接池實戰(zhàn)
- 讀故事學(xué)編程:Python王國歷險記
- C/C++程序設(shè)計教程