Interface ThrowableFunction0<T>

  • Type Parameters:
    T - The type this function will return
    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 ThrowableFunction0<T>
    A function that takes no arguments and returns a value of type T.
    The difference with this interface and Function is that it allows for raising checked exceptions.
    Primary use case is to create concise lambda expressions such as the Try.apply(ThrowableFunction0) and Future.apply(ThrowableFunction0)
    Since:
    1.3
    • Method Detail

      • apply

        T apply()
         throws java.lang.Throwable
        Applies this function returning a result.
        Returns:
        The function result
        Throws:
        java.lang.Throwable - Any error that may occur when applying the function
        Since:
        1.3