Interface OptionalFunction<I,​O>

  • All Superinterfaces:
    Function<I,​Optional<? extends O>>
    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 OptionalFunction<I,​O>
    extends Function<I,​Optional<? extends O>>
    • Method Detail

      • fallback

        default Function<I,​O> fallback​(Function<? super I,​? extends O> fallback)
        Create a function which will fall back to the return values from fallback when this function doesn't return a value.
        Parameters:
        fallback - The function to call back to when this returns no value.
        Returns:
        A function which will return values from this or, if needed, the fallback.
        See Also:
        IOptionalFunctional.fallback(Function)
      • override

        default OptionalFunction<I,​O> override​(OptionalFunction<? super I,​? extends O> override)
        Create a optional function where any value returned from override overrides the value this function would return.
        Parameters:
        override - The function whose return values, when any, override our own.
        Returns:
        An optional function which returns the results of override if any, and the result of this optional function otherwise.
        See Also:
        IOptionalFunctional.override(IOptionalFunctional)