Interface ThrowingRunnable<E extends java.lang.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 java.lang.Exception>
    Represents an action that can be performed. Function might throw a checked exception instance.
    • Method Detail

      • run

        void run()
          throws E extends java.lang.Exception
        Throws:
        E extends java.lang.Exception
      • unchecked

        static java.lang.Runnable unchecked​(ThrowingRunnable<?> runnable)
      • sneaky

        static java.lang.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 java.lang.Runnable unchecked()
        Returns:
        a new Runnable instance which wraps thrown checked exception instance into a RuntimeException