RxJava
rx.operators
Class OperationFirstOrDefault
java.lang.Object
rx.operators.OperationFirstOrDefault
public final class OperationFirstOrDefault
- extends java.lang.Object
Returns an Observable that emits the first item emitted by the source
Observable, or a default value if the source emits nothing.
|
Method Summary |
static
|
firstOrDefault(Observable<? extends T> source,
Func1<? super T,java.lang.Boolean> predicate,
T defaultValue)
Returns an Observable that emits the first item emitted by the source
Observable that satisfies the given condition,
or a default value if the source emits no items that satisfy the given condition. |
static
|
firstOrDefault(Observable<? extends T> source,
T defaultValue)
Returns an Observable that emits the first item emitted by the source
Observable, or a default value if the source emits nothing. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
OperationFirstOrDefault
public OperationFirstOrDefault()
firstOrDefault
public static <T> Observable.OnSubscribeFunc<T> firstOrDefault(Observable<? extends T> source,
Func1<? super T,java.lang.Boolean> predicate,
T defaultValue)
- Returns an Observable that emits the first item emitted by the source
Observable that satisfies the given condition,
or a default value if the source emits no items that satisfy the given condition.
- Parameters:
source - The source Observable to emit the first item for.predicate - The condition the emitted source items have to satisfy.defaultValue - The default value to use whenever the source Observable doesn't emit anything.
- Returns:
- A subscription function for creating the target Observable.
firstOrDefault
public static <T> Observable.OnSubscribeFunc<T> firstOrDefault(Observable<? extends T> source,
T defaultValue)
- Returns an Observable that emits the first item emitted by the source
Observable, or a default value if the source emits nothing.
- Parameters:
source - The source Observable to emit the first item for.defaultValue - The default value to use whenever the source Observable doesn't emit anything.
- Returns:
- A subscription function for creating the target Observable.