- 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);
}
}
推薦閱讀
- Deploying Node.js
- 高效微控制器C語言編程
- 深入淺出Prometheus:原理、應用、源碼與拓展詳解
- Java從入門到精通(第4版)
- 用戶體驗增長:數字化·智能化·綠色化
- ANSYS Fluent 二次開發指南
- Mobile Device Exploitation Cookbook
- Building Serverless Architectures
- Unity 2017 Game AI Programming(Third Edition)
- Mastering OAuth 2.0
- Mastering Leap Motion
- 分布式數據庫HBase案例教程
- Responsive Web Design with jQuery
- Python高性能編程(第2版)
- Hands-On ROS for Robotics Programming