Top Description Inners Fields Constructors Methods
rx.internal.operators

public final Class OperatorSingle<T>

extends Object
implements Observable.Operator<T, T>
Class Inheritance
All Implemented Interfaces
rx.Observable.Operator, rx.functions.Func1, rx.functions.Function
Type Parameters
<T>
the value type
Imports
java.util.NoSuchElementException, rx.Observable.Operator, .Subscriber, rx.internal.producers.SingleProducer, rx.plugins.RxJavaHooks

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 and Inner Type Summary

Modifier and TypeClass and Description
pack-priv static class
pack-priv static class

Field Summary

Modifier and TypeField and Description
private final T
private final boolean

Constructor Summary

AccessConstructor and Description
pack-priv
public
OperatorSingle(T defaultValue)

private
OperatorSingle(boolean hasDefaultValue, final T defaultValue)

Method Summary

Modifier and TypeMethod and Description
public Subscriber<? super T>
call(final Subscriber<? super T> child)

Implements rx.functions.Func1.call.

public static <
the value type
T
>
OperatorSingle<T>

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.
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.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

defaultValueback to summary
private final T defaultValue
hasDefaultValueback to summary
private final boolean hasDefaultValue

Constructor Detail

OperatorSingleback to summary
pack-priv OperatorSingle()
OperatorSingleback to summary
public OperatorSingle(T defaultValue)
OperatorSingleback to summary
private OperatorSingle(boolean hasDefaultValue, final T defaultValue)

Method Detail

callback to summary
public Subscriber<? super T> call(final Subscriber<? super T> child)

Implements rx.functions.Func1.call.

Annotations
@Override
instanceback to summary
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.

Parameters
<T>
the value type
Returns:OperatorSingle<T>

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.

Annotations
@SuppressWarnings:unchecked
rx.internal.operators back to summary

pack-priv final Class OperatorSingle.Holder

extends Object
Class Inheritance

Field Summary

Modifier and TypeField and Description
pack-priv static final OperatorSingle<?>

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

INSTANCEback to summary
pack-priv static final OperatorSingle<?> INSTANCE

Constructor Detail

Holderback to summary
pack-priv Holder()
rx.internal.operators back to summary

pack-priv final Class OperatorSingle.ParentSubscriber<T>

extends Subscriber<T>
Class Inheritance

Field Summary

Modifier and TypeField and Description
private final Subscriber<? super T>
private final T
private final boolean
private boolean
private boolean
private T

Constructor Summary

AccessConstructor and Description
pack-priv
ParentSubscriber(Subscriber<? super T> child, boolean hasDefaultValue, T defaultValue)

Method Summary

Modifier and TypeMethod and Description
public void
onCompleted()

Implements rx.Observer.onCompleted.

Notifies the Observer that the Observable has finished sending push-based notifications.
public void
onError(Throwable
the exception encountered by the Observable
e
)

Implements rx.Observer.onError.

Notifies the Observer that the Observable has experienced an error condition.
public void
onNext(T
the item emitted by the Observable
value
)

Implements rx.Observer.onNext.

Provides the Observer with a new item to observe.
Inherited from rx.Subscriber:
addisUnsubscribedonStartrequestsetProducerunsubscribe

Field Detail

childback to summary
private final Subscriber<? super T> child
defaultValueback to summary
private final T defaultValue
hasDefaultValueback to summary
private final boolean hasDefaultValue
hasTooManyElementsback to summary
private boolean hasTooManyElements
isNonEmptyback to summary
private boolean isNonEmpty
valueback to summary
private T value

Constructor Detail

ParentSubscriberback to summary
pack-priv ParentSubscriber(Subscriber<? super T> child, boolean hasDefaultValue, T defaultValue)

Method Detail

onCompletedback to summary
public void onCompleted()

Implements rx.Observer.onCompleted.

Doc from rx.Observer.onCompleted.

Notifies the Observer that the Observable has finished sending push-based notifications.

The Observable will not call this method if it calls onError.

Annotations
@Override
onErrorback to summary
public void onError(Throwable e)

Implements rx.Observer.onError.

Doc from rx.Observer.onError.

Notifies the Observer that the Observable has experienced an error condition.

If the Observable calls this method, it will not thereafter call onNext or onCompleted.

Parameters
e:Throwable

the exception encountered by the Observable

Annotations
@Override
onNextback to summary
public void onNext(T value)

Implements rx.Observer.onNext.

Doc from rx.Observer.onNext.

Provides the Observer with a new item to observe.

The Observable may call this method 0 or more times.

The Observable will not call this method again after it calls either onCompleted or onError.

Parameters
value:T

the item emitted by the Observable

Annotations
@Override