- 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);
}
}
推薦閱讀
- Web應(yīng)用系統(tǒng)開發(fā)實(shí)踐(C#)
- OpenDaylight Cookbook
- Magento 2 Theme Design(Second Edition)
- Mastering QGIS
- 青少年美育趣味課堂:XMind思維導(dǎo)圖制作
- 老“碼”識(shí)途
- MySQL數(shù)據(jù)庫(kù)管理與開發(fā)實(shí)踐教程 (清華電腦學(xué)堂)
- C語(yǔ)言程序設(shè)計(jì)
- 組態(tài)軟件技術(shù)與應(yīng)用
- SQL Server從入門到精通(第3版)
- PHP編程基礎(chǔ)與實(shí)例教程
- Java零基礎(chǔ)實(shí)戰(zhàn)
- Go語(yǔ)言從入門到精通
- 軟件測(cè)試分析與實(shí)踐
- Python預(yù)測(cè)分析與機(jī)器學(xué)習(xí)