Interface RuntimeExceptionSupplier<E extends RuntimeException>

Type Parameters:
E - the exception type
All Superinterfaces:
Supplier<E>

public interface RuntimeExceptionSupplier<E extends RuntimeException> extends Supplier<E>
Supplies a runtime exception.
Author:
Paul Ferraro
  • Method Summary

    Modifier and Type
    Method
    Description
    of(E exception)
    Returns a supplier that always returns the specified exception.
    default <T> Supplier<T>
    Returns a supplier of an arbitrary type that throws the supplied exception.

    Methods inherited from interface java.util.function.Supplier

    get
  • Method Details

    • of

      static <E extends RuntimeException> RuntimeExceptionSupplier<E> of(E exception)
      Returns a supplier that always returns the specified exception.
      Type Parameters:
      E - the exception type
      Parameters:
      exception - the supplied exception
      Returns:
      a supplier that always returns the specified exception.
    • thenThrow

      default <T> Supplier<T> thenThrow()
      Returns a supplier of an arbitrary type that throws the supplied exception.
      Type Parameters:
      T - the supplied type, though never returned
      Returns:
      a supplier of an arbitrary type that throws the supplied exception.