Class MaybeSubject<T>
- Type Parameters:
T- the value type received and emitted
- All Implemented Interfaces:
MaybeObserver<T>, MaybeSource<T>
This subject does not have a public constructor by design; a new non-terminated instance of this
MaybeSubject can be created via the create() method.
Since the MaybeSubject is conceptionally derived from the Processor type in the Reactive Streams specification,
nulls are not allowed (Rule 2.13)
as parameters to onSuccess(Object) and onError(Throwable). Such calls will result in a
NullPointerException being thrown and the subject's state is not changed.
Since a MaybeSubject is a Maybe, calling onSuccess, onError
or onComplete will move this MaybeSubject into its terminal state atomically.
All methods are thread safe. Calling onSuccess(Object) or onComplete() multiple
times has no effect. Calling onError(Throwable) multiple times relays the Throwable to
the RxJavaPlugins.onError(Throwable) global error handler.
Even though MaybeSubject implements the MaybeObserver interface, calling
onSubscribe is not required (Rule 2.12)
if the subject is used as a standalone source. However, calling onSubscribe
after the MaybeSubject reached its terminal state will result in the
given Disposable being disposed immediately.
This MaybeSubject supports the standard state-peeking methods hasComplete(), hasThrowable(),
getThrowable() and hasObservers() as well as means to read any success item in a non-blocking
and thread-safe manner via hasValue() and getValue().
The MaybeSubject does not support clearing its cached onSuccess value.
- Scheduler:
MaybeSubjectdoes not operate by default on a particularSchedulerand theMaybeObservers get notified on the thread where the terminatingonSuccess,onErrororonCompletemethods were invoked.- Error handling:
- When the
onError(Throwable)is called, theMaybeSubjectenters into a terminal state and emits the sameThrowableinstance to the last set ofMaybeObservers. During this emission, if one or moreMaybeObservers dispose their respectiveDisposables, theThrowableis delivered to the global error handler viaRxJavaPlugins.onError(Throwable)(multiple times if multipleMaybeObservers cancel at once). If there were noMaybeObservers subscribed to thisMaybeSubjectwhen theonError()was called, the global error handler is not invoked.
Example usage:
MaybeSubject<Integer> subject1 = MaybeSubject.create();
TestObserver<Integer> to1 = subject1.test();
// MaybeSubjects are empty by default
to1.assertEmpty();
subject1.onSuccess(1);
// onSuccess is a terminal event with MaybeSubjects
// TestObserver converts onSuccess into onNext + onComplete
to1.assertResult(1);
TestObserver<Integer> to2 = subject1.test();
// late Observers receive the terminal signal (onSuccess) too
to2.assertResult(1);
// -----------------------------------------------------
MaybeSubject<Integer> subject2 = MaybeSubject.create();
TestObserver<Integer> to3 = subject2.test();
subject2.onComplete();
// a completed MaybeSubject completes its MaybeObservers
to3.assertResult();
TestObserver<Integer> to4 = subject1.test();
// late Observers receive the terminal signal (onComplete) too
to4.assertResult();
History: 2.0.5 - experimental
- Since:
- 2.1
-
Method Summary
Modifier and TypeMethodDescriptionstatic <T> @NonNull MaybeSubject<T> create()Creates a fresh MaybeSubject.Returns the terminal error if this MaybeSubject has been terminated with an error, null otherwise.getValue()Returns the success value if this MaybeSubject was terminated with a success value.booleanReturns true if this MaybeSubject has been completed.booleanReturns true if this MaybeSubject has observers.booleanReturns true if this MaybeSubject has been terminated with an error.booleanhasValue()Returns true if this MaybeSubject was terminated with a success value.voidCalled once the deferred computation completes normally.voidNotifies theMaybeObserverthat theMaybehas experienced an error condition.voidProvides theMaybeObserverwith the means of cancelling (disposing) the connection (channel) with theMaybein both synchronous (from withinonSubscribe(Disposable)itself) and asynchronous manner.voidNotifies theMaybeObserverwith one item and that theMaybehas finished sending push-based notifications.protected voidsubscribeActual(MaybeObserver<? super T> observer) Implement this method in subclasses to handle the incomingMaybeObservers.Methods inherited from class Maybe
amb, ambArray, ambWith, blockingGet, blockingGet, blockingSubscribe, blockingSubscribe, blockingSubscribe, blockingSubscribe, blockingSubscribe, cache, cast, compose, concat, concat, concat, concat, concat, concat, concatArray, concatArrayDelayError, concatArrayEager, concatArrayEagerDelayError, concatDelayError, concatDelayError, concatDelayError, concatEager, concatEager, concatEager, concatEager, concatEagerDelayError, concatEagerDelayError, concatEagerDelayError, concatEagerDelayError, concatMap, concatMapCompletable, concatMapSingle, concatWith, contains, count, create, defaultIfEmpty, defer, delay, delay, delay, delay, delay, delaySubscription, delaySubscription, delaySubscription, dematerialize, doAfterSuccess, doAfterTerminate, doFinally, doOnComplete, doOnDispose, doOnError, doOnEvent, doOnLifecycle, doOnSubscribe, doOnSuccess, doOnTerminate, empty, error, error, filter, flatMap, flatMap, flatMap, flatMapCompletable, flatMapObservable, flatMapPublisher, flatMapSingle, flattenAsFlowable, flattenAsObservable, flattenStreamAsFlowable, flattenStreamAsObservable, fromAction, fromCallable, fromCompletable, fromCompletionStage, fromFuture, fromFuture, fromObservable, fromOptional, fromPublisher, fromRunnable, fromSingle, fromSupplier, hide, ignoreElement, isEmpty, just, lift, map, mapOptional, materialize, merge, merge, merge, merge, merge, merge, merge, mergeArray, mergeArrayDelayError, mergeDelayError, mergeDelayError, mergeDelayError, mergeDelayError, mergeDelayError, mergeDelayError, mergeWith, never, observeOn, ofType, onErrorComplete, onErrorComplete, onErrorResumeNext, onErrorResumeWith, onErrorReturn, onErrorReturnItem, onTerminateDetach, repeat, repeat, repeatUntil, repeatWhen, retry, retry, retry, retry, retry, retryUntil, retryWhen, safeSubscribe, sequenceEqual, sequenceEqual, startWith, startWith, startWith, startWith, startWith, subscribe, subscribe, subscribe, subscribe, subscribe, subscribe, subscribeOn, subscribeWith, switchIfEmpty, switchIfEmpty, switchOnNext, switchOnNextDelayError, takeUntil, takeUntil, test, test, timeInterval, timeInterval, timeInterval, timeInterval, timeout, timeout, timeout, timeout, timeout, timeout, timeout, timeout, timer, timer, timestamp, timestamp, timestamp, timestamp, to, toCompletionStage, toCompletionStage, toFlowable, toFuture, toObservable, toSingle, unsafeCreate, unsubscribeOn, using, using, wrap, zip, zip, zip, zip, zip, zip, zip, zip, zip, zipArray, zipWithModifier and TypeMethodDescriptionRuns multipleMaybeSources provided by anIterablesequence and signals the events of the first one that signals (disposing the rest).ambArray(@NonNull MaybeSource<? extends @NonNull T>... sources) Runs multipleMaybeSources and signals the events of the first one that signals (disposing the rest).ambWith(@NonNull MaybeSource<? extends T> other) Mirrors theMaybeSource(current or provided) that first signals an event.final TWaits in a blocking fashion until the currentMaybesignals a success value (which is returned),nullif completed or an exception (which is propagated).final TblockingGet(T defaultValue) Waits in a blocking fashion until the currentMaybesignals a success value (which is returned), defaultValue if completed or an exception (which is propagated).final voidSubscribes to the currentMaybeand blocks the current thread until it terminates.final voidblockingSubscribe(@NonNull MaybeObserver<? super T> observer) Subscribes to the currentMaybeand calls the appropriateMaybeObservermethod on the current thread.final voidblockingSubscribe(@NonNull Consumer<? super T> onSuccess) Subscribes to the currentMaybeand calls givenonSuccesscallback on the current thread when it completes normally.final voidblockingSubscribe(@NonNull Consumer<? super T> onSuccess, @NonNull Consumer<? super Throwable> onError) Subscribes to the currentMaybeand calls the appropriate callback on the current thread when it terminates.final voidblockingSubscribe(@NonNull Consumer<? super T> onSuccess, @NonNull Consumer<? super Throwable> onError, @NonNull Action onComplete) Subscribes to the currentMaybeand calls the appropriate callback on the current thread when it terminates.cache()Returns aMaybethat subscribes to thisMaybelazily, caches its event and replays it, to all the downstream subscribers.Casts the success value of the currentMaybeinto the target type or signals aClassCastExceptionif not compatible.compose(@NonNull MaybeTransformer<? super T, ? extends @NonNull R> transformer) Transform aMaybeby applying a particularMaybeTransformerfunction to it.concat(@NonNull MaybeSource<? extends @NonNull T> source1, @NonNull MaybeSource<? extends @NonNull T> source2) Returns aFlowablethat emits the items emitted by twoMaybeSources, one after the other.concat(@NonNull MaybeSource<? extends @NonNull T> source1, @NonNull MaybeSource<? extends @NonNull T> source2, @NonNull MaybeSource<? extends @NonNull T> source3) Returns aFlowablethat emits the items emitted by threeMaybeSources, one after the other.concat(@NonNull MaybeSource<? extends @NonNull T> source1, @NonNull MaybeSource<? extends @NonNull T> source2, @NonNull MaybeSource<? extends @NonNull T> source3, @NonNull MaybeSource<? extends @NonNull T> source4) Returns aFlowablethat emits the items emitted by fourMaybeSources, one after the other.Concatenate the single values, in a non-overlapping fashion, of theMaybeSourcesources provided by anIterablesequence as aFlowablesequence.concat(@NonNull Flow.Publisher<@NonNull ? extends MaybeSource<? extends @NonNull T>> sources) Concatenate the single values, in a non-overlapping fashion, of theMaybeSourcesources provided by aFlow.Publishersequence as aFlowablesequence.concat(@NonNull Flow.Publisher<@NonNull ? extends MaybeSource<? extends @NonNull T>> sources, int prefetch) Concatenate the single values, in a non-overlapping fashion, of theMaybeSourcesources provided by aFlow.Publishersequence as aFlowablesequence.concatArray(@NonNull MaybeSource<? extends @NonNull T>... sources) Concatenate the single values, in a non-overlapping fashion, of theMaybeSourcesources in the array as aFlowablesequence.concatArrayDelayError(@NonNull MaybeSource<? extends @NonNull T>... sources) Concatenates a variable number ofMaybeSourcesources and delays errors from any of them till all terminate as aFlowablesequence.concatArrayEager(@NonNull MaybeSource<? extends @NonNull T>... sources) Concatenates a sequence ofMaybeSourceeagerly into aFlowablesequence.concatArrayEagerDelayError(@NonNull MaybeSource<? extends @NonNull T>... sources) Concatenates a sequence ofMaybeSourceeagerly into aFlowablesequence.concatDelayError(@NonNull Iterable<@NonNull ? extends MaybeSource<? extends @NonNull T>> sources) Concatenates theIterablesequence ofMaybeSources into a single sequence by subscribing to eachMaybeSource, one after the other, one at a time and delays any errors till the all innerMaybeSources terminate as aFlowablesequence.concatDelayError(@NonNull Flow.Publisher<@NonNull ? extends MaybeSource<? extends @NonNull T>> sources) Concatenates theFlow.Publishersequence ofMaybeSources into a single sequence by subscribing to each innerMaybeSource, one after the other, one at a time and delays any errors till the all inner and the outerPublisherterminate as aFlowablesequence.concatDelayError(@NonNull Flow.Publisher<@NonNull ? extends MaybeSource<? extends @NonNull T>> sources, int prefetch) Concatenates theFlow.Publishersequence ofMaybeSources into a single sequence by subscribing to each innerMaybeSource, one after the other, one at a time and delays any errors till the all inner and the outerPublisherterminate as aFlowablesequence.concatEager(@NonNull Iterable<@NonNull ? extends MaybeSource<? extends @NonNull T>> sources) Concatenates a sequence ofMaybeSources eagerly into aFlowablesequence.concatEager(@NonNull Iterable<@NonNull ? extends MaybeSource<? extends @NonNull T>> sources, int maxConcurrency) Concatenates a sequence ofMaybeSources eagerly into aFlowablesequence and runs a limited number of the inner sequences at once.concatEager(@NonNull Flow.Publisher<@NonNull ? extends MaybeSource<? extends @NonNull T>> sources) concatEager(@NonNull Flow.Publisher<@NonNull ? extends MaybeSource<? extends @NonNull T>> sources, int maxConcurrency) Concatenates aFlow.Publishersequence ofMaybeSources eagerly into aFlowablesequence, running at most the given number of innerMaybeSources at once.concatEagerDelayError(@NonNull Iterable<@NonNull ? extends MaybeSource<? extends @NonNull T>> sources) Concatenates a sequence ofMaybeSources eagerly into aFlowablesequence, delaying errors until all innerMaybeSources terminate.concatEagerDelayError(@NonNull Iterable<@NonNull ? extends MaybeSource<? extends @NonNull T>> sources, int maxConcurrency) Concatenates a sequence ofMaybeSources eagerly into aFlowablesequence, delaying errors until all innerMaybeSources terminate and runs a limited number of innerMaybeSources at once.concatEagerDelayError(@NonNull Flow.Publisher<@NonNull ? extends MaybeSource<? extends @NonNull T>> sources) Concatenates aFlow.Publishersequence ofMaybeSources eagerly into aFlowablesequence, delaying errors until all the inner and the outer sequence terminate.concatEagerDelayError(@NonNull Flow.Publisher<@NonNull ? extends MaybeSource<? extends @NonNull T>> sources, int maxConcurrency) Concatenates aFlow.Publishersequence ofMaybeSources eagerly into aFlowablesequence, delaying errors until all the inner and the outer sequence terminate and runs a limited number of the innerMaybeSources at once.Returns aMaybethat is based on applying a specified function to the item emitted by the currentMaybe, where that function returns aMaybeSource.final @NonNull CompletableconcatMapCompletable(@NonNull Function<? super T, ? extends CompletableSource> mapper) Returns aCompletablethat completes based on applying a specified function to the item emitted by the currentMaybe, where that function returns aCompletable.concatMapSingle(@NonNull Function<? super T, ? extends SingleSource<? extends @NonNull R>> mapper) Returns aMaybebased on applying a specified function to the item emitted by the currentMaybe, where that function returns aSingle.concatWith(@NonNull MaybeSource<? extends T> other) Returns aFlowablethat emits the items emitted from the currentMaybe, then theotherMaybeSource, one after the other, without interleaving them.count()create(@NonNull MaybeOnSubscribe<@NonNull T> onSubscribe) Provides an API (via a coldMaybe) that bridges the reactive world with the callback-style world.defaultIfEmpty(T defaultItem) Returns aSinglethat emits the item emitted by the currentMaybeor a specified default item if the currentMaybeis empty.Calls aSupplierfor each individualMaybeObserverto return the actualMaybeSourcesource to be subscribed to.Returns aMaybethat signals the events emitted by the currentMaybeshifted forward in time by a specified delay.Returns aMaybethat signals the events emitted by the currentMaybeshifted forward in time by a specified delay.Returns aMaybethat signals the events emitted by the currentMaybeshifted forward in time by a specified delay.Returns aMaybethat signals the events emitted by the currentMaybeshifted forward in time by a specified delay running on the specifiedScheduler.delay(@NonNull Flow.Publisher<@NonNull U> delayIndicator) Delays the emission of thisMaybeuntil the givenFlow.Publishersignals an item or completes.delaySubscription(long time, @NonNull TimeUnit unit) Returns aMaybethat delays the subscription to the currentMaybeby a given amount of time.delaySubscription(long time, @NonNull TimeUnit unit, @NonNull Scheduler scheduler) Returns aMaybethat delays the subscription to the currentMaybeby a given amount of time, both waiting and subscribing on a givenScheduler.delaySubscription(@NonNull Flow.Publisher<@NonNull U> subscriptionIndicator) Returns aMaybethat delays the subscription to thisMaybeuntil the otherFlow.Publisheremits an element or completes normally.dematerialize(@NonNull Function<? super T, @NonNull Notification<@NonNull R>> selector) Maps theNotificationsuccess value of the currentMaybeback into normalonSuccess,onErrororonCompletesignals.doAfterSuccess(@NonNull Consumer<? super T> onAfterSuccess) Calls the specifiedConsumerwith the success item after this item has been emitted to the downstream.doAfterTerminate(@NonNull Action onAfterTerminate) Calls the specified action after thisMaybesignalsonSuccess,onErrororonCompleteor gets disposed by the downstream.doOnComplete(@NonNull Action onComplete) doOnDispose(@NonNull Action onDispose) Calls the sharedActionif aMaybeObserversubscribed to the currentMaybedisposes the commonDisposableit received viaonSubscribe.Calls the sharedConsumerwith the error sent viaonErrorfor eachMaybeObserverthat subscribes to the currentMaybe.Calls the givenonEventcallback with the (success value,null) for anonSuccess, (null, throwable) for anonErroror (null,null) for anonCompletesignal from thisMaybebefore delivering said signal to the downstream.doOnLifecycle(@NonNull Consumer<? super Disposable> onSubscribe, @NonNull Action onDispose) Calls the appropriateonXXXmethod (shared between allMaybeObservers) for the lifecycle events of the sequence (subscription, disposal).doOnSubscribe(@NonNull Consumer<? super Disposable> onSubscribe) Calls the sharedConsumerwith theDisposablesent through theonSubscribefor eachMaybeObserverthat subscribes to the currentMaybe.doOnSuccess(@NonNull Consumer<? super T> onSuccess) Calls the sharedConsumerwith the success value sent viaonSuccessfor eachMaybeObserverthat subscribes to the currentMaybe.doOnTerminate(@NonNull Action onTerminate) Returns aMaybeinstance that calls the given onTerminate callback just before thisMaybecompletes normally or with an exception.empty()Returns a (singleton)Maybeinstance that callsonCompleteimmediately.Returns aMaybethat invokes aMaybeObserver'sonErrormethod when theMaybeObserversubscribes to it.Returns aMaybethat invokes a subscriber'sonErrormethod when the subscriber subscribes to it.Filters the success item of theMaybevia a predicate function and emitting it if the predicate returnstrue, completing otherwise.Returns aMaybethat is based on applying a specified function to the item emitted by the currentMaybe, where that function returns aMaybeSource.flatMap(@NonNull Function<? super T, ? extends MaybeSource<? extends @NonNull R>> onSuccessMapper, @NonNull Function<? super Throwable, ? extends MaybeSource<? extends @NonNull R>> onErrorMapper, @NonNull Supplier<? extends MaybeSource<? extends @NonNull R>> onCompleteSupplier) Maps theonSuccess,onErrororonCompletesignals of the currentMaybeinto aMaybeSourceand emits thatMaybeSource's signals.flatMap(@NonNull Function<? super T, ? extends MaybeSource<? extends @NonNull U>> mapper, @NonNull BiFunction<? super T, ? super @NonNull U, ? extends @NonNull R> combiner) Returns aMaybethat emits the results of a specified function to the pair of values emitted by the currentMaybeand a specified mappedMaybeSource.final @NonNull CompletableflatMapCompletable(@NonNull Function<? super T, ? extends CompletableSource> mapper) Returns aCompletablethat completes based on applying a specified function to the item emitted by the currentMaybe, where that function returns aCompletable.final <@NonNull R>
@NonNull Observable<R> flatMapObservable(@NonNull Function<? super T, ? extends ObservableSource<? extends @NonNull R>> mapper) Returns anObservablethat is based on applying a specified function to the item emitted by the currentMaybe, where that function returns anObservableSource.flatMapPublisher(@NonNull Function<? super T, @NonNull ? extends Flow.Publisher<? extends @NonNull R>> mapper) Returns aFlowablethat emits items based on applying a specified function to the item emitted by the currentMaybe, where that function returns aFlow.Publisher.flatMapSingle(@NonNull Function<? super T, ? extends SingleSource<? extends @NonNull R>> mapper) Returns aMaybebased on applying a specified function to the item emitted by the currentMaybe, where that function returns aSingle.flattenAsFlowable(@NonNull Function<? super T, @NonNull ? extends Iterable<? extends @NonNull U>> mapper) final <@NonNull U>
@NonNull Observable<U> flattenAsObservable(@NonNull Function<? super T, @NonNull ? extends Iterable<? extends @NonNull U>> mapper) Maps the success value of the currentMaybeinto anIterableand emits its items as anObservablesequence.flattenStreamAsFlowable(@NonNull Function<? super T, @NonNull ? extends Stream<? extends @NonNull R>> mapper) final <@NonNull R>
@NonNull Observable<R> flattenStreamAsObservable(@NonNull Function<? super T, @NonNull ? extends Stream<? extends @NonNull R>> mapper) Maps the upstream succecss value into a JavaStreamand emits its items to the downstream consumer as anObservable.fromAction(@NonNull Action action) Returns aMaybeinstance that runs the givenActionfor eachMaybeObserverand emits either its exception or simply completes.fromCallable(@NonNull Callable<? extends @Nullable T> callable) Returns aMaybethat invokes the givenCallablefor each individualMaybeObserverthat subscribes and emits the resulting non-nullitem viaonSuccesswhile considering anullresult from theCallableas indication for valueless completion viaonComplete.fromCompletable(@NonNull CompletableSource completableSource) Wraps aCompletableSourceinto aMaybe.fromCompletionStage(@NonNull CompletionStage<@NonNull T> stage) Signals the completion value or error of the given (hot)CompletionStage-based asynchronous calculation.fromFuture(@NonNull Future<? extends @NonNull T> future) fromObservable(@NonNull ObservableSource<@NonNull T> source) Wraps anObservableSourceinto aMaybeand emits the very first item or completes if the source is empty.fromOptional(@NonNull Optional<@NonNull T> optional) Converts the existing value of the provided optional into aMaybe.just(Object)or an empty optional into anMaybe.empty()Maybeinstance.fromPublisher(@NonNull Flow.Publisher<@NonNull T> source) Wraps aFlow.Publisherinto aMaybeand emits the very first item or completes if the source is empty.fromRunnable(@NonNull Runnable run) Returns aMaybeinstance that runs the givenRunnablefor eachMaybeObserverand emits either its unchecked exception or simply completes.fromSingle(@NonNull SingleSource<@NonNull T> single) Wraps aSingleSourceinto aMaybe.fromSupplier(@NonNull Supplier<? extends @Nullable T> supplier) Returns aMaybethat invokes the givenSupplierfor each individualMaybeObserverthat subscribes and emits the resulting non-nullitem viaonSuccesswhile considering anullresult from theSupplieras indication for valueless completion viaonComplete.hide()Hides the identity of thisMaybeand itsDisposable.final @NonNull CompletableReturns aCompletablethat ignores the item emitted by the currentMaybeand only callsonCompleteoronError.isEmpty()Returns aMaybethat emits a specified item.lift(@NonNull MaybeOperator<? extends @NonNull R, ? super T> lift) This method requires advanced knowledge about building operators, please consider other standard composition methods first; Returns aMaybewhich, when subscribed to, invokes theapply(MaybeObserver)method of the providedMaybeOperatorfor each individual downstreamMaybeand allows the insertion of a custom operator by accessing the downstream'sMaybeObserverduring this subscription phase and providing a newMaybeObserver, containing the custom operator's intended business logic, that will be used in the subscription process going further upstream.Returns aMaybethat applies a specified function to the item emitted by the currentMaybeand emits the result of this function application.Maps the upstream success value into anOptionaland emits the contained item if not empty.final @NonNull Single<Notification<T>> Maps the signal types of thisMaybeinto aNotificationof the same kind and emits it as aSingle'sonSuccessvalue to downstream.merge(@NonNull MaybeSource<? extends MaybeSource<? extends @NonNull T>> source) Flattens aMaybeSourcethat emits aMaybeSourceinto a singleMaybeSourcethat emits the item emitted by the nestedMaybeSource, without any transformation.merge(@NonNull MaybeSource<? extends @NonNull T> source1, @NonNull MaybeSource<? extends @NonNull T> source2) Flattens twoMaybeSources into a singleFlowable, without any transformation.merge(@NonNull MaybeSource<? extends @NonNull T> source1, @NonNull MaybeSource<? extends @NonNull T> source2, @NonNull MaybeSource<? extends @NonNull T> source3) Flattens threeMaybeSources into a singleFlowable, without any transformation.merge(@NonNull MaybeSource<? extends @NonNull T> source1, @NonNull MaybeSource<? extends @NonNull T> source2, @NonNull MaybeSource<? extends @NonNull T> source3, @NonNull MaybeSource<? extends @NonNull T> source4) Flattens fourMaybeSources into a singleFlowable, without any transformation.Merges anIterablesequence ofMaybeSourceinstances into a singleFlowablesequence, running allMaybeSources at once.merge(@NonNull Flow.Publisher<@NonNull ? extends MaybeSource<? extends @NonNull T>> sources) Merges aFlow.Publishersequence ofMaybeSourceinstances into a singleFlowablesequence, running allMaybeSources at once.merge(@NonNull Flow.Publisher<@NonNull ? extends MaybeSource<? extends @NonNull T>> sources, int maxConcurrency) Merges aFlow.Publishersequence ofMaybeSourceinstances into a singleFlowablesequence, running at most maxConcurrencyMaybeSources at once.mergeArray(MaybeSource<? extends @NonNull T>... sources) Merges an array ofMaybeSourceinstances into a singleFlowablesequence, running allMaybeSources at once.mergeArrayDelayError(@NonNull MaybeSource<? extends @NonNull T>... sources) Flattens an array ofMaybeSources into oneFlowable, in a way that allows a subscriber to receive all successfully emitted items from each of the sourceMaybeSources without being interrupted by an error notification from one of them.mergeDelayError(@NonNull MaybeSource<? extends @NonNull T> source1, @NonNull MaybeSource<? extends @NonNull T> source2) Flattens twoMaybeSources into oneFlowable, in a way that allows a subscriber to receive all successfully emitted items from each of the sourceMaybeSources without being interrupted by an error notification from one of them.mergeDelayError(@NonNull MaybeSource<? extends @NonNull T> source1, @NonNull MaybeSource<? extends @NonNull T> source2, @NonNull MaybeSource<? extends @NonNull T> source3) Flattens threeMaybeSourceinto oneFlowable, in a way that allows a subscriber to receive all successfully emitted items from all of the sourceMaybeSources without being interrupted by an error notification from one of them.mergeDelayError(@NonNull MaybeSource<? extends @NonNull T> source1, @NonNull MaybeSource<? extends @NonNull T> source2, @NonNull MaybeSource<? extends @NonNull T> source3, @NonNull MaybeSource<? extends @NonNull T> source4) Flattens fourMaybeSources into oneFlowable, in a way that allows a subscriber to receive all successfully emitted items from all of the sourceMaybeSources without being interrupted by an error notification from one of them.mergeDelayError(@NonNull Iterable<@NonNull ? extends MaybeSource<? extends @NonNull T>> sources) Flattens anIterablesequence ofMaybeSources into oneFlowable, in a way that allows a subscriber to receive all successfully emitted items from each of the sourceMaybeSources without being interrupted by an error notification from one of them.mergeDelayError(@NonNull Flow.Publisher<@NonNull ? extends MaybeSource<? extends @NonNull T>> sources) Flattens aFlow.Publisherthat emitsMaybeSources into oneFlowable, in a way that allows a subscriber to receive all successfully emitted items from all of the sourceMaybeSources without being interrupted by an error notification from one of them or even the mainPublisher.mergeDelayError(@NonNull Flow.Publisher<@NonNull ? extends MaybeSource<? extends @NonNull T>> sources, int maxConcurrency) Flattens aFlow.Publisherthat emitsMaybeSources into oneFlowable, in a way that allows a subscriber to receive all successfully emitted items from all of the sourceMaybeSources without being interrupted by an error notification from one of them or even the mainPublisheras well as limiting the total number of activeMaybeSources.mergeWith(@NonNull MaybeSource<? extends T> other) never()Returns aMaybethat never sends any items or notifications to aMaybeObserver.Wraps aMaybeto emit its item (or notify of its error) on a specifiedScheduler, asynchronously.Filters the items emitted by the currentMaybe, only emitting its success value if that is an instance of the suppliedClass.Returns aMaybeinstance that if thisMaybeemits an error, it will emit anonCompleteand swallow the throwable.onErrorComplete(@NonNull Predicate<? super Throwable> predicate) Returns aMaybeinstance that if thisMaybeemits an error and the predicate returnstrue, it will emit anonCompleteand swallow the throwable.onErrorResumeNext(@NonNull Function<? super Throwable, ? extends MaybeSource<? extends T>> fallbackSupplier) Resumes the flow with aMaybeSourcereturned for the failureThrowableof the currentMaybeby a function instead of signaling the error viaonError.onErrorResumeWith(@NonNull MaybeSource<? extends T> fallback) Resumes the flow with the givenMaybeSourcewhen the currentMaybefails instead of signaling the error viaonError.onErrorReturn(@NonNull Function<? super Throwable, ? extends T> itemSupplier) Ends the flow with a success item returned by a function for theThrowableerror signaled by the currentMaybeinstead of signaling the error viaonError.onErrorReturnItem(T item) Ends the flow with the given success item when the currentMaybefails instead of signaling the error viaonError.Nulls out references to the upstream producer and downstreamMaybeObserverif the sequence is terminated or downstream callsdispose().repeat()Returns aFlowablethat repeats the sequence of items emitted by the currentMaybeindefinitely.repeat(long times) Returns aFlowablethat repeats the sequence of items emitted by the currentMaybeat mostcounttimes.Returns aFlowablethat repeats the sequence of items emitted by the currentMaybeuntil the provided stop function returnstrue.repeatWhen(@NonNull Function<? super Flowable<Object>, @NonNull ? extends Flow.Publisher<@NonNull ?>> handler) Returns aFlowablethat emits the same values as the currentMaybewith the exception of anonComplete.retry()Returns aMaybethat mirrors the currentMaybe, resubscribing to it if it callsonError(infinite retry count).retry(long times) Returns aMaybethat mirrors the currentMaybe, resubscribing to it if it callsonErrorup to a specified number of retries.Retries at mosttimesor until the predicate returnsfalse, whichever happens first.retry(@NonNull BiPredicate<? super Integer, ? super Throwable> predicate) Returns aMaybethat mirrors the currentMaybe, resubscribing to it if it callsonErrorand the predicate returnstruefor that specific exception and retry count.Retries the currentMaybeif it fails and the predicate returnstrue.Retries until the given stop function returnstrue.retryWhen(@NonNull Function<? super Flowable<Throwable>, @NonNull ? extends Flow.Publisher<@NonNull ?>> handler) Returns aMaybethat emits the same values as the currentMaybewith the exception of anonError.final voidsafeSubscribe(@NonNull MaybeObserver<? super T> observer) Wraps the givenMaybeObserver, catches anyRuntimeExceptions thrown by itsMaybeObserver.onSubscribe(Disposable),MaybeObserver.onSuccess(Object),MaybeObserver.onError(Throwable)orMaybeObserver.onComplete()methods and routes those to the global error handler viaRxJavaPlugins.onError(Throwable).sequenceEqual(@NonNull MaybeSource<? extends @NonNull T> source1, @NonNull MaybeSource<? extends @NonNull T> source2) Returns aSinglethat emits aBooleanvalue that indicates whether twoMaybeSourcesequences are the same by comparing the items emitted by eachMaybeSourcepairwise.sequenceEqual(@NonNull MaybeSource<? extends @NonNull T> source1, @NonNull MaybeSource<? extends @NonNull T> source2, @NonNull BiPredicate<? super @NonNull T, ? super @NonNull T> isEqual) Returns aSinglethat emits aBooleanvalue that indicates whether twoMaybeSources are the same by comparing the items emitted by eachMaybeSourcepairwise based on the results of a specified equality function.startWith(@NonNull CompletableSource other) Returns aFlowablewhich first runs the otherCompletableSourcethen the currentMaybeif the other completed normally.startWith(@NonNull MaybeSource<T> other) Returns aFlowablewhich first runs the otherMaybeSourcethen the currentMaybeif the other succeeded or completed normally.final @NonNull Observable<T> startWith(@NonNull ObservableSource<T> other) Returns anObservablewhich first delivers the events of the otherObservableSourcethen runs the currentMaybe.startWith(@NonNull SingleSource<T> other) Returns aFlowablewhich first runs the otherSingleSourcethen the currentMaybeif the other succeeded normally.startWith(@NonNull Flow.Publisher<T> other) Returns aFlowablewhich first delivers the events of the otherFlow.Publisherthen runs the currentMaybe.final @NonNull DisposableSubscribes to aMaybeand ignoresonSuccessandonCompleteemissions.final voidsubscribe(@NonNull MaybeObserver<? super T> observer) Subscribes the givenMaybeObserverto thisMaybeSourceinstance.final @NonNull DisposableSubscribes to aMaybeand provides a callback to handle the items it emits.final @NonNull DisposableSubscribes to aMaybeand provides callbacks to handle the items it emits and any error notification it issues.final @NonNull Disposablesubscribe(@NonNull Consumer<? super T> onSuccess, @NonNull Consumer<? super Throwable> onError, @NonNull Action onComplete) Subscribes to aMaybeand provides callbacks to handle the items it emits and any error or completion notification it issues.final @NonNull Disposablesubscribe(@NonNull Consumer<? super T> onSuccess, @NonNull Consumer<? super Throwable> onError, @NonNull Action onComplete, @NonNull DisposableContainer container) Wraps the given onXXX callbacks into aDisposableMaybeObserver, adds it to the givenDisposableContainerand ensures, that if the upstream terminates or this particularDisposableis disposed, theMaybeObserveris removed from the given composite.subscribeOn(@NonNull Scheduler scheduler) Asynchronously subscribes subscribers to thisMaybeon the specifiedScheduler.final <@NonNull E extends MaybeObserver<? super @NonNull T>>
EsubscribeWith(@NonNull E observer) Subscribes a givenMaybeObserver(subclass) to thisMaybeand returns the givenMaybeObserveras is.switchIfEmpty(@NonNull MaybeSource<? extends T> other) Returns aMaybethat emits the items emitted by the currentMaybeor the items of an alternateMaybeSourceif the currentMaybeis empty.switchIfEmpty(@NonNull SingleSource<? extends T> other) Returns aSinglethat emits the items emitted by the currentMaybeor the item of an alternateSingleSourceif the currentMaybeis empty.switchOnNext(@NonNull Flow.Publisher<@NonNull ? extends MaybeSource<? extends @NonNull T>> sources) Switches betweenMaybeSources emitted by the sourceFlow.Publisherwhenever a newMaybeSourceis emitted, disposing the previously runningMaybeSource, exposing the success items as aFlowablesequence.switchOnNextDelayError(@NonNull Flow.Publisher<@NonNull ? extends MaybeSource<? extends @NonNull T>> sources) Switches betweenMaybeSources emitted by the sourceFlow.Publisherwhenever a newMaybeSourceis emitted, disposing the previously runningMaybeSource, exposing the success items as aFlowablesequence and delaying all errors from all of them until all terminate.takeUntil(@NonNull MaybeSource<@NonNull U> other) Returns aMaybethat emits the items emitted by the currentMaybeuntil a secondMaybeSourceemits an item.takeUntil(@NonNull Flow.Publisher<@NonNull U> other) Returns aMaybethat emits the item emitted by the currentMaybeuntil a secondFlow.Publisheremits an item.final @NonNull TestObserver<T> test()Creates aTestObserverand subscribes it to thisMaybe.final @NonNull TestObserver<T> test(boolean dispose) Creates aTestObserveroptionally in cancelled state, then subscribes it to thisMaybe.Measures the time (in milliseconds) between the subscription and success item emission of the currentMaybeand signals it as a tuple (Timed) success value.timeInterval(@NonNull Scheduler scheduler) Measures the time (in milliseconds) between the subscription and success item emission of the currentMaybeand signals it as a tuple (Timed) success value.timeInterval(@NonNull TimeUnit unit) Measures the time between the subscription and success item emission of the currentMaybeand signals it as a tuple (Timed) success value.timeInterval(@NonNull TimeUnit unit, @NonNull Scheduler scheduler) Measures the time between the subscription and success item emission of the currentMaybeand signals it as a tuple (Timed) success value.Returns aMaybethat mirrors the currentMaybebut applies a timeout policy for each emitted item.Returns aMaybethat mirrors the currentMaybebut applies a timeout policy for each emitted item.Returns aMaybethat mirrors the currentMaybebut applies a timeout policy for each emitted item, where this policy is governed on a specifiedScheduler.timeout(long timeout, @NonNull TimeUnit unit, @NonNull Scheduler scheduler, @NonNull MaybeSource<? extends T> fallback) Returns aMaybethat mirrors the currentMaybebut applies a timeout policy for each emitted item using a specifiedScheduler.timeout(@NonNull MaybeSource<@NonNull U> timeoutIndicator) If the currentMaybedidn't signal an event before thetimeoutIndicatorMaybeSourcesignals, aTimeoutExceptionis signaled instead.timeout(@NonNull MaybeSource<@NonNull U> timeoutIndicator, @NonNull MaybeSource<? extends T> fallback) If the currentMaybedidn't signal an event before thetimeoutIndicatorMaybeSourcesignals, the currentMaybeis disposed and thefallbackMaybeSourcesubscribed to as a continuation.timeout(@NonNull Flow.Publisher<@NonNull U> timeoutIndicator) If the currentMaybesource didn't signal an event before thetimeoutIndicatorFlow.Publishersignals, aTimeoutExceptionis signaled instead.timeout(@NonNull Flow.Publisher<@NonNull U> timeoutIndicator, @NonNull MaybeSource<? extends T> fallback) If the currentMaybedidn't signal an event before thetimeoutIndicatorFlow.Publishersignals, the currentMaybeis disposed and thefallbackMaybeSourcesubscribed to as a continuation.Returns aMaybethat emits0Lafter a specified delay.final <R> Rto(@NonNull MaybeConverter<T, ? extends R> converter) Calls the specified converter function during assembly time and returns its resulting value.final @NonNull CompletionStage<T> Signals the upstream success item (or aNoSuchElementExceptionif the upstream is empty) via aCompletionStage.final @NonNull CompletionStage<T> toCompletionStage(T defaultItem) Signals the upstream success item (or the default item if the upstream is empty) via aCompletionStage.Converts thisMaybeinto a backpressure-awareFlowableinstance composing cancellation through.toFuture()Returns aFuturerepresenting the single value emitted by the currentMaybeornullif the currentMaybeis empty.final @NonNull Observable<T> Converts thisMaybeinto anObservableinstance composing disposal through.toSingle()Converts thisMaybeinto aSingleinstance composing disposal through and turning an emptyMaybeinto a signal ofNoSuchElementException.unsafeCreate(@NonNull MaybeSource<@NonNull T> onSubscribe) Advanced use only: creates aMaybeinstance without any safeguards by using a callback that is called with aMaybeObserver.unsubscribeOn(@NonNull Scheduler scheduler) Returns aMaybewhich makes sure when aMaybeObserverdisposes theDisposable, that call is propagated up on the specifiedScheduler.using(@NonNull Supplier<? extends @NonNull D> resourceSupplier, @NonNull Function<? super @NonNull D, ? extends MaybeSource<? extends @NonNull T>> sourceSupplier, @NonNull Consumer<? super @NonNull D> resourceCleanup) Constructs aMaybethat creates a dependent resource object which is disposed of when the generatedMaybeSourceterminates or the downstream calls dispose().using(@NonNull Supplier<? extends @NonNull D> resourceSupplier, @NonNull Function<? super @NonNull D, ? extends MaybeSource<? extends @NonNull T>> sourceSupplier, @NonNull Consumer<? super @NonNull D> resourceCleanup, boolean eager) Constructs aMaybethat creates a dependent resource object which is disposed first ({code eager == true}) when the generatedMaybeSourceterminates or the downstream disposes; or after ({code eager == false}).wrap(@NonNull MaybeSource<@NonNull T> source) static <@NonNull T1, @NonNull T2, @NonNull T3, @NonNull T4, @NonNull T5, @NonNull T6, @NonNull T7, @NonNull T8, @NonNull T9, @NonNull R>
@NonNull Maybe<R> zip(@NonNull MaybeSource<? extends @NonNull T1> source1, @NonNull MaybeSource<? extends @NonNull T2> source2, @NonNull MaybeSource<? extends @NonNull T3> source3, @NonNull MaybeSource<? extends @NonNull T4> source4, @NonNull MaybeSource<? extends @NonNull T5> source5, @NonNull MaybeSource<? extends @NonNull T6> source6, @NonNull MaybeSource<? extends @NonNull T7> source7, @NonNull MaybeSource<? extends @NonNull T8> source8, @NonNull MaybeSource<? extends @NonNull T9> source9, @NonNull Function9<? super @NonNull T1, ? super @NonNull T2, ? super @NonNull T3, ? super @NonNull T4, ? super @NonNull T5, ? super @NonNull T6, ? super @NonNull T7, ? super @NonNull T8, ? super @NonNull T9, ? extends @NonNull R> zipper) Returns aMaybethat emits the results of a specified combiner function applied to combinations of nine items emitted, in sequence, by nine otherMaybeSources.static <@NonNull T1, @NonNull T2, @NonNull T3, @NonNull T4, @NonNull T5, @NonNull T6, @NonNull T7, @NonNull T8, @NonNull R>
@NonNull Maybe<R> zip(@NonNull MaybeSource<? extends @NonNull T1> source1, @NonNull MaybeSource<? extends @NonNull T2> source2, @NonNull MaybeSource<? extends @NonNull T3> source3, @NonNull MaybeSource<? extends @NonNull T4> source4, @NonNull MaybeSource<? extends @NonNull T5> source5, @NonNull MaybeSource<? extends @NonNull T6> source6, @NonNull MaybeSource<? extends @NonNull T7> source7, @NonNull MaybeSource<? extends @NonNull T8> source8, @NonNull Function8<? super @NonNull T1, ? super @NonNull T2, ? super @NonNull T3, ? super @NonNull T4, ? super @NonNull T5, ? super @NonNull T6, ? super @NonNull T7, ? super @NonNull T8, ? extends @NonNull R> zipper) Returns aMaybethat emits the results of a specified combiner function applied to combinations of eight items emitted, in sequence, by eight otherMaybeSources.static <@NonNull T1, @NonNull T2, @NonNull T3, @NonNull T4, @NonNull T5, @NonNull T6, @NonNull T7, @NonNull R>
@NonNull Maybe<R> zip(@NonNull MaybeSource<? extends @NonNull T1> source1, @NonNull MaybeSource<? extends @NonNull T2> source2, @NonNull MaybeSource<? extends @NonNull T3> source3, @NonNull MaybeSource<? extends @NonNull T4> source4, @NonNull MaybeSource<? extends @NonNull T5> source5, @NonNull MaybeSource<? extends @NonNull T6> source6, @NonNull MaybeSource<? extends @NonNull T7> source7, @NonNull Function7<? super @NonNull T1, ? super @NonNull T2, ? super @NonNull T3, ? super @NonNull T4, ? super @NonNull T5, ? super @NonNull T6, ? super @NonNull T7, ? extends @NonNull R> zipper) Returns aMaybethat emits the results of a specified combiner function applied to combinations of seven items emitted, in sequence, by seven otherMaybeSources.static <@NonNull T1, @NonNull T2, @NonNull T3, @NonNull T4, @NonNull T5, @NonNull T6, @NonNull R>
@NonNull Maybe<R> zip(@NonNull MaybeSource<? extends @NonNull T1> source1, @NonNull MaybeSource<? extends @NonNull T2> source2, @NonNull MaybeSource<? extends @NonNull T3> source3, @NonNull MaybeSource<? extends @NonNull T4> source4, @NonNull MaybeSource<? extends @NonNull T5> source5, @NonNull MaybeSource<? extends @NonNull T6> source6, @NonNull Function6<? super @NonNull T1, ? super @NonNull T2, ? super @NonNull T3, ? super @NonNull T4, ? super @NonNull T5, ? super @NonNull T6, ? extends @NonNull R> zipper) Returns aMaybethat emits the results of a specified combiner function applied to combinations of six items emitted, in sequence, by six otherMaybeSources.static <@NonNull T1, @NonNull T2, @NonNull T3, @NonNull T4, @NonNull T5, @NonNull R>
@NonNull Maybe<R> zip(@NonNull MaybeSource<? extends @NonNull T1> source1, @NonNull MaybeSource<? extends @NonNull T2> source2, @NonNull MaybeSource<? extends @NonNull T3> source3, @NonNull MaybeSource<? extends @NonNull T4> source4, @NonNull MaybeSource<? extends @NonNull T5> source5, @NonNull Function5<? super @NonNull T1, ? super @NonNull T2, ? super @NonNull T3, ? super @NonNull T4, ? super @NonNull T5, ? extends @NonNull R> zipper) Returns aMaybethat emits the results of a specified combiner function applied to combinations of five items emitted, in sequence, by five otherMaybeSources.zip(@NonNull MaybeSource<? extends @NonNull T1> source1, @NonNull MaybeSource<? extends @NonNull T2> source2, @NonNull MaybeSource<? extends @NonNull T3> source3, @NonNull MaybeSource<? extends @NonNull T4> source4, @NonNull Function4<? super @NonNull T1, ? super @NonNull T2, ? super @NonNull T3, ? super @NonNull T4, ? extends @NonNull R> zipper) Returns aMaybethat emits the results of a specified combiner function applied to combinations of four items emitted, in sequence, by four otherMaybeSources.zip(@NonNull MaybeSource<? extends @NonNull T1> source1, @NonNull MaybeSource<? extends @NonNull T2> source2, @NonNull MaybeSource<? extends @NonNull T3> source3, @NonNull Function3<? super @NonNull T1, ? super @NonNull T2, ? super @NonNull T3, ? extends @NonNull R> zipper) Returns aMaybethat emits the results of a specified combiner function applied to combinations of three items emitted, in sequence, by three otherMaybeSources.zip(@NonNull MaybeSource<? extends @NonNull T1> source1, @NonNull MaybeSource<? extends @NonNull T2> source2, @NonNull BiFunction<? super @NonNull T1, ? super @NonNull T2, ? extends @NonNull R> zipper) Returns aMaybethat emits the results of a specified combiner function applied to combinations of two items emitted, in sequence, by two otherMaybeSources.zip(@NonNull Iterable<@NonNull ? extends MaybeSource<? extends @NonNull T>> sources, @NonNull Function<? super Object[], ? extends @NonNull R> zipper) Returns aMaybethat emits the results of a specified combiner function applied to combinations of items emitted, in sequence, by anIterableof otherMaybeSources.zipArray(@NonNull Function<? super Object[], ? extends @NonNull R> zipper, @NonNull MaybeSource<? extends @NonNull T>... sources) Returns aMaybethat emits the results of a specified combiner function applied to combinations of items emitted, in sequence, by an array of otherMaybeSources.zipWith(@NonNull MaybeSource<? extends @NonNull U> other, @NonNull BiFunction<? super T, ? super @NonNull U, ? extends @NonNull R> zipper) Waits until this and the otherMaybeSourcesignal a success value then applies the givenBiFunctionto those values and emits theBiFunction's resulting value to downstream.
-
Method Details
-
create
Creates a fresh MaybeSubject.- Type Parameters:
T- the value type received and emitted- Returns:
- the new MaybeSubject instance
-
onSubscribe
Description copied from interface:MaybeObserverProvides theMaybeObserverwith the means of cancelling (disposing) the connection (channel) with theMaybein both synchronous (from withinonSubscribe(Disposable)itself) and asynchronous manner.- Specified by:
onSubscribein interfaceMaybeObserver<T>- Parameters:
d- theDisposableinstance whoseDisposable.dispose()can be called anytime to cancel the connection
-
onSuccess
Description copied from interface:MaybeObserverNotifies theMaybeObserverwith one item and that theMaybehas finished sending push-based notifications.The
Maybewill not call this method if it callsMaybeObserver.onError(Throwable).- Specified by:
onSuccessin interfaceMaybeObserver<T>- Parameters:
value- the item emitted by theMaybe
-
onError
Description copied from interface:MaybeObserverNotifies theMaybeObserverthat theMaybehas experienced an error condition.If the
Maybecalls this method, it will not thereafter callMaybeObserver.onSuccess(T).- Specified by:
onErrorin interfaceMaybeObserver<T>- Parameters:
e- the exception encountered by theMaybe
-
onComplete
public void onComplete()Description copied from interface:MaybeObserverCalled once the deferred computation completes normally.- Specified by:
onCompletein interfaceMaybeObserver<T>
-
subscribeActual
Description copied from class:MaybeImplement this method in subclasses to handle the incomingMaybeObservers.There is no need to call any of the plugin hooks on the current
Maybeinstance or theMaybeObserver; all hooks and basic safeguards have been applied byMaybe.subscribe(MaybeObserver)before this method gets called.- Specified by:
subscribeActualin classMaybe<T>- Parameters:
observer- theMaybeObserverto handle, notnull
-
getValue
-
hasValue
public boolean hasValue()Returns true if this MaybeSubject was terminated with a success value.- Returns:
- true if this MaybeSubject was terminated with a success value
-
getThrowable
-
hasThrowable
public boolean hasThrowable()Returns true if this MaybeSubject has been terminated with an error.- Returns:
- true if this MaybeSubject has been terminated with an error
-
hasComplete
public boolean hasComplete()Returns true if this MaybeSubject has been completed.- Returns:
- true if this MaybeSubject has been completed
-
hasObservers
public boolean hasObservers()Returns true if this MaybeSubject has observers.- Returns:
- true if this MaybeSubject has observers
-