Class OperatorSingle<T>

  • All Implemented Interfaces:
    Func1<Subscriber<? super T>,Subscriber<? super T>>, Function, Observable.Operator<T,T>


    public final class OperatorSingle<T>
    extends Object
    implements Observable.Operator<T,T>
    If the Observable completes after emitting a single item that matches a predicate, return an Observable containing that item. If it emits more than one such item or no item, throw an IllegalArgumentException.
    • Constructor Detail

      • OperatorSingle

        public OperatorSingle(T defaultValue)
    • Method Detail

      • instance

        public static <T> OperatorSingle<T> instance()
        Returns a singleton instance of OperatorSingle (if the stream is empty or has more than one element an error will be emitted) that is cast to the generic type.
        Returns:
        a singleton instance of an Operator that will emit a single value only unless the stream has zero or more than one element in which case it will emit an error.