RxJava



rx.operators
Class OperationDefaultIfEmpty

java.lang.Object
  extended by rx.operators.OperationDefaultIfEmpty

public class OperationDefaultIfEmpty
extends java.lang.Object

Returns the elements of the specified sequence or the specified default value in a singleton sequence if the sequence is empty.


Constructor Summary
OperationDefaultIfEmpty()
           
 
Method Summary
static
<T> Observable.OnSubscribeFunc<T>
defaultIfEmpty(Observable<? extends T> source, T defaultValue)
          Returns the elements of the specified sequence or the specified default value in a singleton sequence if the sequence is empty.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

OperationDefaultIfEmpty

public OperationDefaultIfEmpty()
Method Detail

defaultIfEmpty

public static <T> Observable.OnSubscribeFunc<T> defaultIfEmpty(Observable<? extends T> source,
                                                               T defaultValue)
Returns the elements of the specified sequence or the specified default value in a singleton sequence if the sequence is empty.

Parameters:
source - The sequence to return the specified value for if it is empty.
defaultValue - The value to return if the sequence is empty.
Returns:
An observable sequence that contains the specified default value if the source is empty; otherwise, the elements of the source itself.