forked from ReactiveX/RxJava
-
Notifications
You must be signed in to change notification settings - Fork 0
Blocking Observable Operators
DavidMGross edited this page May 28, 2013
·
49 revisions
This section explains the BlockingObservable subclass. A Blocking Observable extends the ordinary Observable class by providing a set of operators on the emissions of the Observable that block.
To transform an
Observableinto aBlockingObservable, use theObservable.toBlockingObservable( )method or theBlockingObservable.from( )method.
-
forEach( )— invoke a closure on each element emitted by the Observable; block until the Observable completes -
last( )— block until the Observable completes, then return the last item emitted by the Observable -
lastOrDefault( )— -
mostRecent( )— immediately return the item most recently emitted by the Observable -
next( )— block until the Observable emits an item, then return that item -
single( )— if the Observable completes after emitting a single item, return that item, otherwise throw an exception -
singleOrDefault( )— if the Observable completes after emitting a single item, return that item, otherwise return a default value -
toFuture( )— convert the Observable into a Future -
toIterable( )— convert the sequence emitted by the Observable into an Iterable -
getIterator( )ortoIterator( )— convert the sequence emitted by the Observable into an Iterator




if the Observable completes after emitting a single item, return that item, otherwise throw an exception (or return a default value)


A Netflix Original Production
Tech Blog | Twitter @NetflixOSS | Twitter @RxJava | Jobs
- Introduction
- Getting Started
- JavaDoc
- How to Use RxJava
- Additional Reading
- The Observable
- Operators (Alphabetical List)
- Async
- Blocking Observable
- Combining
- Conditional & Boolean
- Connectable Observable
- Error Handling
- Filtering
- Mathematical and Aggregate
- Observable Creation
- String
- Transformational
- Utility Operators
- Implementing Custom Operators, previous
- Backpressure
- Error Handling
- Plugins
- Schedulers
- Subjects
- The RxJava Android Module
- RxJava 2.0
- How to Contribute