Top Description Inners Fields Constructors Methods
io.reactivex.rxjava3.internal.operators.mixed

public final Class ObservableSwitchMapSingle<T, R>

extends Observable<R>
Class Inheritance
Type Parameters
<T>
the upstream value type
<R>
the downstream value type
Imports
java.util.Objects, java.util.concurrent.atomic.*, io.reactivex.rxjava3.core.*, io.reactivex.rxjava3.disposables.Disposable, io.reactivex.rxjava3.exceptions.Exceptions, io.reactivex.rxjava3.functions.Function, io.reactivex.rxjava3.internal.disposables.DisposableHelper, io.reactivex.rxjava3.internal.util.AtomicThrowable, io.reactivex.rxjava3.plugins.RxJavaPlugins

Maps the upstream items into SingleSources and switches (subscribes) to the newer ones while disposing the older ones and emits the latest success value if available, optionally delaying errors from the main source or the inner sources.

History: 2.1.11 - experimental

Since
2.2

Nested and Inner Type Summary

Modifier and TypeClass and Description
pack-priv static class

Field Summary

Modifier and TypeField and Description
pack-priv final boolean
pack-priv final Function<? super T, ? extends SingleSource<? extends R>>
pack-priv final Observable<T>

Constructor Summary

AccessConstructor and Description
public
ObservableSwitchMapSingle(Observable<T> source, Function<? super T, ? extends SingleSource<? extends R>> mapper, boolean delayErrors)

Method Summary

Modifier and TypeMethod and Description
protected void
subscribeActual(Observer<? super R> observer)

Inherited from io.reactivex.rxjava3.core.Observable:
allambambArrayambWithanyblockingFirstblockingFirstblockingForEachblockingForEachblockingIterableblockingIterableblockingLastblockingLastblockingLatestblockingMostRecentblockingNextblockingSingleblockingSingleblockingStreamblockingStreamblockingSubscribeblockingSubscribeblockingSubscribeblockingSubscribeblockingSubscribebufferbufferbufferbufferbufferbufferbufferbufferbufferbufferbufferbufferbufferbufferbufferbufferbufferbufferSizecachecacheWithInitialCapacitycastcollectcollectcollectIntocombineLatestcombineLatestcombineLatestcombineLatestcombineLatestcombineLatestcombineLatestcombineLatestcombineLatestcombineLatestcombineLatestArraycombineLatestArraycombineLatestArrayDelayErrorcombineLatestArrayDelayErrorcombineLatestDelayErrorcombineLatestDelayErrorcomposeconcatconcatconcatconcatconcatconcatconcatArrayconcatArrayDelayErrorconcatArrayEagerconcatArrayEagerconcatArrayEagerDelayErrorconcatArrayEagerDelayErrorconcatDelayErrorconcatDelayErrorconcatDelayErrorconcatEagerconcatEagerconcatEagerconcatEagerconcatEagerDelayErrorconcatEagerDelayErrorconcatEagerDelayErrorconcatEagerDelayErrorconcatMapconcatMapconcatMapconcatMapCompletableconcatMapCompletableconcatMapCompletableDelayErrorconcatMapCompletableDelayErrorconcatMapCompletableDelayErrorconcatMapDelayErrorconcatMapDelayErrorconcatMapDelayErrorconcatMapEagerconcatMapEagerconcatMapEagerDelayErrorconcatMapEagerDelayErrorconcatMapIterableconcatMapMaybeconcatMapMaybeconcatMapMaybeDelayErrorconcatMapMaybeDelayErrorconcatMapMaybeDelayErrorconcatMapSingleconcatMapSingleconcatMapSingleDelayErrorconcatMapSingleDelayErrorconcatMapSingleDelayErrorconcatMapStreamconcatWithconcatWithconcatWithconcatWithcontainscountcreatedebouncedebouncedebouncedebouncedefaultIfEmptydeferdelaydelaydelaydelaydelaydelaydelaySubscriptiondelaySubscriptiondelaySubscriptiondematerializedistinctdistinctdistinctdistinctUntilChangeddistinctUntilChangeddistinctUntilChangeddoAfterNextdoAfterTerminatedoFinallydoOnCompletedoOnDisposedoOnEachdoOnEachdoOnErrordoOnLifecycledoOnNextdoOnSubscribedoOnTerminateelementAtelementAtelementAtOrErroremptyerrorerrorfilterfirstfirstElementfirstOrErrorfirstOrErrorStagefirstStageflatMapflatMapflatMapflatMapflatMapflatMapflatMapflatMapflatMapflatMapflatMapflatMapflatMapCompletableflatMapCompletableflatMapIterableflatMapIterableflatMapMaybeflatMapMaybeflatMapSingleflatMapSingleflatMapStreamforEachforEachWhileforEachWhileforEachWhilefromActionfromArrayfromCallablefromCompletablefromCompletionStagefromFuturefromFuturefromIterablefromMaybefromOptionalfromPublisherfromRunnablefromSinglefromStreamfromSuppliergenerategenerategenerategenerategenerategroupBygroupBygroupBygroupBygroupBygroupJoinhideignoreElementsintervalintervalintervalintervalintervalRangeintervalRangeisEmptyjoinjustjustjustjustjustjustjustjustjustjustlastlastElementlastOrErrorlastOrErrorStagelastStageliftmapmapOptionalmaterializemergemergemergemergemergemergemergemergemergeArraymergeArraymergeArrayDelayErrormergeArrayDelayErrormergeDelayErrormergeDelayErrormergeDelayErrormergeDelayErrormergeDelayErrormergeDelayErrormergeDelayErrormergeDelayErrormergeWithmergeWithmergeWithmergeWithneverobserveOnobserveOnobserveOnofTypeonErrorCompleteonErrorCompleteonErrorResumeNextonErrorResumeWithonErrorReturnonErrorReturnItemonTerminateDetachpublishpublishrangerangeLongreducereducereduceWithrepeatrepeatrepeatUntilrepeatWhenreplayreplayreplayreplayreplayreplayreplayreplayreplayreplayreplayreplayreplayreplayreplayreplayreplayreplayretryretryretryretryretryretryUntilretryWhensafeSubscribesamplesamplesamplesamplesamplesamplesamplescanscanscanWithsequenceEqualsequenceEqualsequenceEqualsequenceEqualserializesharesinglesingleElementsingleOrErrorsingleOrErrorStagesingleStageskipskipskipskipLastskipLastskipLastskipLastskipLastskipLastskipUntilskipWhilesortedsortedstartWithstartWithstartWithstartWithstartWithArraystartWithItemstartWithIterablesubscribesubscribesubscribesubscribesubscribesubscribesubscribeActualsubscribeOnsubscribeWithswitchIfEmptyswitchMapswitchMapswitchMapCompletableswitchMapCompletableDelayErrorswitchMapDelayErrorswitchMapDelayErrorswitchMapMaybeswitchMapMaybeDelayErrorswitchMapSingleswitchMapSingleDelayErrorswitchOnNextswitchOnNextswitchOnNextDelayErrorswitchOnNextDelayErrortaketaketaketakeLasttakeLasttakeLasttakeLasttakeLasttakeLasttakeLasttakeLasttakeLasttakeUntiltakeUntiltakeWhiletesttestthrottleFirstthrottleFirstthrottleFirstthrottleLastthrottleLastthrottleLastthrottleLatestthrottleLatestthrottleLatestthrottleLatestthrottleLatestthrottleWithTimeoutthrottleWithTimeoutthrottleWithTimeouttimeIntervaltimeIntervaltimeIntervaltimeIntervaltimeouttimeouttimeouttimeouttimeouttimeouttimeouttimeouttimertimertimestamptimestamptimestamptimestamptotoFlowabletoFuturetoListtoListtoListtoMaptoMaptoMaptoMultimaptoMultimaptoMultimaptoMultimaptoSortedListtoSortedListtoSortedListtoSortedListunsafeCreateunsubscribeOnusingusingwindowwindowwindowwindowwindowwindowwindowwindowwindowwindowwindowwindowwindowwindowwindowwindowwindowwithLatestFromwithLatestFromwithLatestFromwithLatestFromwithLatestFromwithLatestFromwrapzipzipzipzipzipzipzipzipzipzipzipzipzipArrayzipWithzipWithzipWithzipWith

Field Detail

delayErrorsback to summary
pack-priv final boolean delayErrors
mapperback to summary
pack-priv final Function<? super T, ? extends SingleSource<? extends R>> mapper
sourceback to summary
pack-priv final Observable<T> source

Constructor Detail

ObservableSwitchMapSingleback to summary
public ObservableSwitchMapSingle(Observable<T> source, Function<? super T, ? extends SingleSource<? extends R>> mapper, boolean delayErrors)

Method Detail

subscribeActualback to summary
protected void subscribeActual(Observer<? super R> observer)
Annotations
@Override
io.reactivex.rxjava3.internal.operators.mixed back to summary

pack-priv final Class ObservableSwitchMapSingle.SwitchMapSingleMainObserver<T, R>

extends AtomicInteger
implements Observer<T>, Disposable
Class Inheritance
All Implemented Interfaces
io.reactivex.rxjava3.disposables.Disposable, io.reactivex.rxjava3.core.Observer

Nested and Inner Type Summary

Modifier and TypeClass and Description
pack-priv static class

Field Summary

Modifier and TypeField and Description
pack-priv volatile boolean
pack-priv final boolean
pack-priv volatile boolean
pack-priv final Observer<? super R>
pack-priv final AtomicThrowable
pack-priv final AtomicReference<ObservableSwitchMapSingle.SwitchMapSingleMainObserver.SwitchMapSingleObserver<R>>
pack-priv static final ObservableSwitchMapSingle.SwitchMapSingleMainObserver.SwitchMapSingleObserver<Object>
pack-priv final Function<? super T, ? extends SingleSource<? extends R>>
private static final long
pack-priv Disposable

Constructor Summary

AccessConstructor and Description
pack-priv
SwitchMapSingleMainObserver(Observer<? super R> downstream, Function<? super T, ? extends SingleSource<? extends R>> mapper, boolean delayErrors)

Method Summary

Modifier and TypeMethod and Description
public void
dispose()

Implements io.reactivex.rxjava3.disposables.Disposable.dispose.

Dispose the resource, the operation should be idempotent.
pack-priv void
pack-priv void
pack-priv void
public boolean
isDisposed()

Implements io.reactivex.rxjava3.disposables.Disposable.isDisposed.

Returns true if this resource has been disposed.
public void
onComplete()

Implements io.reactivex.rxjava3.core.Observer.onComplete.

Notifies the Observer that the Observable has finished sending push-based notifications.
public void
public void
onNext(T
the item emitted by the Observable
t
)

Implements io.reactivex.rxjava3.core.Observer.onNext.

Provides the Observer with a new item to observe.
public void
Inherited from java.util.concurrent.atomic.AtomicInteger:
accumulateAndGetaddAndGetcompareAndExchangecompareAndExchangeAcquirecompareAndExchangeReleasecompareAndSetdecrementAndGetdoubleValuefloatValuegetgetAcquiregetAndAccumulategetAndAddgetAndDecrementgetAndIncrementgetAndSetgetAndUpdategetOpaquegetPlainincrementAndGetintValuelazySetlongValuesetsetOpaquesetPlainsetReleasetoStringupdateAndGetweakCompareAndSetweakCompareAndSetAcquireweakCompareAndSetPlainweakCompareAndSetReleaseweakCompareAndSetVolatile

Field Detail

cancelledback to summary
pack-priv volatile boolean cancelled
delayErrorsback to summary
pack-priv final boolean delayErrors
doneback to summary
pack-priv volatile boolean done
downstreamback to summary
pack-priv final Observer<? super R> downstream
errorsback to summary
pack-priv final AtomicThrowable errors
innerback to summary
pack-priv final AtomicReference<ObservableSwitchMapSingle.SwitchMapSingleMainObserver.SwitchMapSingleObserver<R>> inner
INNER_DISPOSEDback to summary
pack-priv static final ObservableSwitchMapSingle.SwitchMapSingleMainObserver.SwitchMapSingleObserver<Object> INNER_DISPOSED
mapperback to summary
pack-priv final Function<? super T, ? extends SingleSource<? extends R>> mapper
serialVersionUIDback to summary
private static final long serialVersionUID

Hides java.util.concurrent.atomic.AtomicInteger.serialVersionUID.

upstreamback to summary
pack-priv Disposable upstream

Constructor Detail

SwitchMapSingleMainObserverback to summary
pack-priv SwitchMapSingleMainObserver(Observer<? super R> downstream, Function<? super T, ? extends SingleSource<? extends R>> mapper, boolean delayErrors)

Method Detail

disposeback to summary
public void dispose()

Implements io.reactivex.rxjava3.disposables.Disposable.dispose.

Doc from io.reactivex.rxjava3.disposables.Disposable.dispose.

Dispose the resource, the operation should be idempotent.

Annotations
@Override
disposeInnerback to summary
pack-priv void disposeInner()
Annotations
@SuppressWarnings:unchecked, rawtypes
drainback to summary
pack-priv void drain()
innerErrorback to summary
pack-priv void innerError(ObservableSwitchMapSingle.SwitchMapSingleMainObserver.SwitchMapSingleObserver<R> sender, Throwable ex)
isDisposedback to summary
public boolean isDisposed()

Implements io.reactivex.rxjava3.disposables.Disposable.isDisposed.

Doc from io.reactivex.rxjava3.disposables.Disposable.isDisposed.

Returns true if this resource has been disposed.

Returns:boolean

true if this resource has been disposed

Annotations
@Override
onCompleteback to summary
public void onComplete()

Implements io.reactivex.rxjava3.core.Observer.onComplete.

Doc from io.reactivex.rxjava3.core.Observer.onComplete.

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 t)
Annotations
@Override
onNextback to summary
public void onNext(T t)

Implements io.reactivex.rxjava3.core.Observer.onNext.

Doc from io.reactivex.rxjava3.core.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 onComplete or onError.

Parameters
t:T

the item emitted by the Observable

Annotations
@Override
@SuppressWarnings:unchecked, rawtypes
onSubscribeback to summary
public void onSubscribe(Disposable d)
Annotations
@Override
io.reactivex.rxjava3.internal.operators.mixed back to summary

pack-priv final Class ObservableSwitchMapSingle.SwitchMapSingleMainObserver.SwitchMapSingleObserver<R>

extends AtomicReference<Disposable>
implements SingleObserver<R>
Class Inheritance
All Implemented Interfaces
io.reactivex.rxjava3.core.SingleObserver

Field Summary

Modifier and TypeField and Description
pack-priv volatile R
pack-priv final ObservableSwitchMapSingle.SwitchMapSingleMainObserver<?, R>
private static final long

Constructor Summary

AccessConstructor and Description
pack-priv

Field Detail

itemback to summary
pack-priv volatile R item
parentback to summary
pack-priv final ObservableSwitchMapSingle.SwitchMapSingleMainObserver<?, R> parent
serialVersionUIDback to summary
private static final long serialVersionUID

Hides java.util.concurrent.atomic.AtomicReference.serialVersionUID.

Constructor Detail

SwitchMapSingleObserverback to summary
pack-priv SwitchMapSingleObserver(ObservableSwitchMapSingle.SwitchMapSingleMainObserver<?, R> parent)

Method Detail

disposeback to summary
pack-priv void dispose()
onErrorback to summary
public void onError(Throwable e)
Annotations
@Override
onSubscribeback to summary
public void onSubscribe(Disposable d)
Annotations
@Override
onSuccessback to summary
public void onSuccess(R t)

Implements io.reactivex.rxjava3.core.SingleObserver.onSuccess.

Doc from io.reactivex.rxjava3.core.SingleObserver.onSuccess.

Notifies the SingleObserver with a single item and that the Single has finished sending push-based notifications.

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

Parameters
t:R

the item emitted by the Single

Annotations
@Override