RxJava:阻塞单个 vs 阻塞优先
RxJava: Blocking single vs Blocking first
我永远无法理解 RxJava 中 Observables
上 blockingSingle
和 blockingFirst
之间的区别。任何帮助将不胜感激。
来自 https://github.com/ReactiveX/RxJava/wiki/Blocking-Observable-Operators
的定义
first() — block until the Observable emits an item, then return the first item
emitted by the Observable
single( ) — if the Observable completes after emitting a single item, return
that item, otherwise throw an exception
听起来像 first()
在发出任何项目后立即 returns,并且 single()
等待 Observable 完成 return。
我永远无法理解 RxJava 中 Observables
上 blockingSingle
和 blockingFirst
之间的区别。任何帮助将不胜感激。
来自 https://github.com/ReactiveX/RxJava/wiki/Blocking-Observable-Operators
的定义first() — block until the Observable emits an item, then return the first item
emitted by the Observable
single( ) — if the Observable completes after emitting a single item, return
that item, otherwise throw an exception
听起来像 first()
在发出任何项目后立即 returns,并且 single()
等待 Observable 完成 return。