Interface ThrowingSupplier<T>

Type Parameters:
T - The type of the supplied value
All Superinterfaces:
Supplier<T>
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 ThrowingSupplier<T> extends Supplier<T>
A Supplier that allows code to throw checked exceptions
Author:
Andrea Coronese
  • Method Details

    • getWithException

      T getWithException() throws Exception
      Gets the supplied value, throwing any caught exception back to the caller
      Returns:
      The supplied value
      Throws:
      Exception - if code completes exceptionally
    • get

      default T get()
      Specified by:
      get in interface Supplier<T>
    • get

      default T get(BiFunction<String,Exception,RuntimeException> exceptionWrapper)
      get.
      Parameters:
      exceptionWrapper - a BiFunction object
      Returns:
      a T object