-
Notifications
You must be signed in to change notification settings - Fork 7.6k
Filtering Observables
David Gross edited this page Jan 12, 2015
·
79 revisions
This page shows operators you can use to filter and select items emitted by Observables.
-
filter( )— filter items emitted by an Observable -
takeLast( )— only emit the last n items emitted by an Observable -
last( )— emit only the last item emitted by an Observable -
lastOrDefault( )— emit only the last item emitted by an Observable, or a default value if the source Observable is empty -
takeLastBuffer( )— emit the last n items emitted by an Observable, as a single list item -
skip( )— ignore the first n items emitted by an Observable -
skipLast( )— ignore the last n items emitted by an Observable -
take( )— emit only the first n items emitted by an Observable -
first( )andtakeFirst( )— emit only the first item emitted by an Observable, or the first item that meets some condition -
firstOrDefault( )— emit only the first item emitted by an Observable, or the first item that meets some condition, or a default value if the source Observable is empty -
elementAt( )— emit item n emitted by the source Observable -
elementAtOrDefault( )— emit item n emitted by the source Observable, or a default item if the source Observable emits fewer than n items -
sample( )orthrottleLast( )— emit the most recent items emitted by an Observable within periodic time intervals -
throttleFirst( )— emit the first items emitted by an Observable within periodic time intervals -
throttleWithTimeout( )ordebounce( )— only emit an item from the source Observable after a particular timespan has passed without the Observable emitting any other items -
timeout( )— emit items from a source Observable, but issue an exception if no item is emitted in a specified timespan -
distinct( )— suppress duplicate items emitted by the source Observable -
distinctUntilChanged( )— suppress duplicate consecutive items emitted by the source Observable -
ofType( )— emit only those items from the source Observable that are of a particular class -
ignoreElements( )— discard the items emitted by the source Observable and only pass through the error or completed notification
Copyright (c) 2016-present, RxJava Contributors.
Twitter @RxJava | Gitter @RxJava