Interface ScalarSupplier<T>

  • Type Parameters:
    T - the scalar value type held by the implementing reactive type
    All Superinterfaces:
    Supplier<T>
    All Known Implementing Classes:
    FlowableEmpty, FlowableJust, MaybeEmpty, MaybeJust, ObservableEmpty, ObservableJust
    Functional Interface:
    This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

    @FunctionalInterface
    public interface ScalarSupplier<@NonNull T>
    extends Supplier<T>
    A marker interface indicating that a scalar, constant value is held by the implementing reactive type which can be safely extracted during assembly time can be used for optimization.

    Implementors of get() should not throw any exception.

    Design note: the interface extends Supplier because if a scalar is safe to extract during assembly time, it is also safe to extract at subscription time or later. This allows optimizations to deal with such single-element sources uniformly.

    Since:
    3.1.1
    • Method Detail

      • get

        T get()
        Description copied from interface: Supplier
        Produces a value or throws an exception.
        Specified by:
        get in interface Supplier<T>
        Returns:
        the value produced