Package rx.internal.operators
Class OperatorSingle<T>
java.lang.Object
rx.internal.operators.OperatorSingle<T>
- Type Parameters:
T
- the value type
- All Implemented Interfaces:
Func1<Subscriber<? super T>,
,Subscriber<? super T>> Function
,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.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescription(package private) static final class
(package private) static final class
-
Field Summary
Fields -
Constructor Summary
ConstructorsModifierConstructorDescription(package private)
private
OperatorSingle
(boolean hasDefaultValue, T defaultValue) OperatorSingle
(T defaultValue) -
Method Summary
Modifier and TypeMethodDescriptionSubscriber
<? super T> call
(Subscriber<? super T> child) 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.
-
Field Details
-
hasDefaultValue
private final boolean hasDefaultValue -
defaultValue
-
-
Constructor Details
-
OperatorSingle
OperatorSingle() -
OperatorSingle
-
OperatorSingle
-
-
Method Details
-
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.- Type Parameters:
T
- the value 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.
-
call
- Specified by:
call
in interfaceFunc1<Subscriber<? super T>,
Subscriber<? super T>>
-