Interface FuseToMaybe<T>

Type Parameters:
T - the value type
All Known Implementing Classes:
MaybeIgnoreElementCompletable, MaybeIsEmptySingle

public interface FuseToMaybe<@NonNull T>
Interface indicating an operator implementation can be macro-fused back to Maybe in case the operator goes from Maybe to some other reactive type and then the sequence calls for toMaybe again:
 
 Single<Integer> single = Maybe.just(1).isEmpty();
 Maybe<Integer> maybe = single.toMaybe();
 
 
The Single.toMaybe() will check for this interface and call the fuseToMaybe() to return a Maybe which could be the Maybe-specific implementation of isEmpty().

This causes a slight overhead in assembly time (1 instanceof check, 1 operator allocation and 1 dropped operator) but does not incur the conversion overhead at runtime.

  • Method Summary

    Modifier and Type
    Method
    Description
    Returns a (direct) Maybe for the operator.
  • Method Details

    • fuseToMaybe

      @NonNull @NonNull Maybe<T> fuseToMaybe()
      Returns a (direct) Maybe for the operator.

      The implementation should handle the necessary RxJavaPlugins wrapping.

      Returns:
      the Maybe instance