Class MaybeToSingle<T>

java.lang.Object
io.reactivex.rxjava3.core.Single<T>
io.reactivex.rxjava3.internal.operators.maybe.MaybeToSingle<T>
Type Parameters:
T - the value type
All Implemented Interfaces:
SingleSource<T>, HasUpstreamMaybeSource<T>

public final class MaybeToSingle<T> extends Single<T> implements HasUpstreamMaybeSource<T>
Wraps a MaybeSource and exposes its onSuccess and onError signals and signals NoSuchElementException for onComplete if defaultValue is null.
  • Field Details

    • source

      final MaybeSource<T> source
    • defaultValue

      final T defaultValue
  • Constructor Details

    • MaybeToSingle

      public MaybeToSingle(MaybeSource<T> source, T defaultValue)
  • Method Details

    • source

      public MaybeSource<T> source()
      Description copied from interface: HasUpstreamMaybeSource
      Returns the upstream source of this Maybe.

      Allows discovering the chain of observables.

      Specified by:
      source in interface HasUpstreamMaybeSource<T>
      Returns:
      the source MaybeSource
    • subscribeActual

      protected void subscribeActual(SingleObserver<? super T> observer)
      Description copied from class: Single
      Implement this method in subclasses to handle the incoming SingleObservers.

      There is no need to call any of the plugin hooks on the current Single instance or the SingleObserver; all hooks and basic safeguards have been applied by Single.subscribe(SingleObserver) before this method gets called.

      Specified by:
      subscribeActual in class Single<T>
      Parameters:
      observer - the SingleObserver to handle, not null