Interface ThrowingRunnable<E extends Exception>

Type Parameters:
E - the type of the thrown checked exception
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 ThrowingRunnable<E extends Exception>
Represents an action that can be performed. Function might throw a checked exception instance.
  • Method Details

    • run

      void run() throws E
      Throws:
      E
    • unchecked

      static Runnable unchecked(ThrowingRunnable<?> runnable)
    • sneaky

      static Runnable sneaky(ThrowingRunnable<?> runnable)
      Returns a new Runnable instance which rethrows the checked exception using the Sneaky Throws pattern
      Returns:
      Runnable instance that rethrows the checked exception using the Sneaky Throws pattern
    • unchecked

      default Runnable unchecked()
      Returns:
      a new Runnable instance which wraps thrown checked exception instance into a RuntimeException