/** * Converts this Single into a {@link Maybe}. * <p> * <img width="640" height="463" src="https://raw.github.com/wiki/ReactiveX/RxJava/images/rx-operators/Single.toMaybe.png" alt=""> * <dl> * <dt><b>Scheduler:</b></dt> * <dd>{@code toMaybe} does not operate by default on a particular {@link Scheduler}.</dd> * </dl> * * @return a {@link Maybe} that emits a single item T or an error. */ @CheckReturnValue @SchedulerSupport(SchedulerSupport.NONE) @SuppressWarnings("unchecked") public final Maybe<T> toMaybe() { if (this instanceof FuseToMaybe) { return ((FuseToMaybe<T>)this).fuseToMaybe(); } return RxJavaPlugins.onAssembly(new MaybeFromSingle<T>(this)); } /**
/** * Converts this Completable into a {@link Maybe}. * <p> * <img width="640" height="585" src="https://raw.github.com/wiki/ReactiveX/RxJava/images/rx-operators/Completable.toMaybe.png" alt=""> * <dl> * <dt><b>Scheduler:</b></dt> * <dd>{@code toMaybe} does not operate by default on a particular {@link Scheduler}.</dd> * </dl> * * @param <T> the value type * @return a {@link Maybe} that only calls {@code onComplete} or {@code onError}, based on which one is * called by the source Completable. */ @CheckReturnValue @SuppressWarnings("unchecked") @SchedulerSupport(SchedulerSupport.NONE) public final <T> Maybe<T> toMaybe() { if (this instanceof FuseToMaybe) { return ((FuseToMaybe<T>)this).fuseToMaybe(); } return RxJavaPlugins.onAssembly(new MaybeFromCompletable<T>(this)); }
/** * Converts this Single into a {@link Maybe}. * <p> * <img width="640" height="305" src="https://raw.github.com/wiki/ReactiveX/RxJava/images/rx-operators/Single.toObservable.png" alt=""> * <dl> * <dt><b>Scheduler:</b></dt> * <dd>{@code toMaybe} does not operate by default on a particular {@link Scheduler}.</dd> * </dl> * * @return a {@link Maybe} that emits a single item T or an error. */ @CheckReturnValue @SchedulerSupport(SchedulerSupport.NONE) @SuppressWarnings("unchecked") public final Maybe<T> toMaybe() { if (this instanceof FuseToMaybe) { return ((FuseToMaybe<T>)this).fuseToMaybe(); } return RxJavaPlugins.onAssembly(new MaybeFromSingle<T>(this)); } /**
/** * Converts this Completable into a {@link Maybe}. * <p> * <img width="640" height="293" src="https://raw.github.com/wiki/ReactiveX/RxJava/images/rx-operators/Completable.toObservable.png" alt=""> * <dl> * <dt><b>Scheduler:</b></dt> * <dd>{@code toMaybe} does not operate by default on a particular {@link Scheduler}.</dd> * </dl> * * @param <T> the value type * @return a {@link Maybe} that only calls {@code onComplete} or {@code onError}, based on which one is * called by the source Completable. */ @CheckReturnValue @SuppressWarnings("unchecked") @SchedulerSupport(SchedulerSupport.NONE) public final <T> Maybe<T> toMaybe() { if (this instanceof FuseToMaybe) { return ((FuseToMaybe<T>)this).fuseToMaybe(); } return RxJavaPlugins.onAssembly(new MaybeFromCompletable<T>(this)); }