Interface Runnable

All Superinterfaces:
Runnable

public interface Runnable extends Runnable
An enhanced runnable.
Author:
Paul Ferraro
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final Runnable
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static <T> Runnable
    accept(Consumer<? super T> consumer, Supplier<? extends T> supplier)
    Returns a task that consumes a value from the specified supplier.
    default Runnable
    Returns a task that runs the specified task after running this task.
    static Runnable
    Returns an empty task.
    default Runnable
    Returns a new runnable that delegates to the specified handler in the event of an exception.
    static Runnable
    runAll(Iterable<? extends Runnable> runners)
    Returns a composite runner that runs the specified runners.

    Methods inherited from interface java.lang.Runnable

    run
  • Field Details

  • Method Details

    • andThen

      default Runnable andThen(Runnable task)
      Returns a task that runs the specified task after running this task.
      Parameters:
      task - a task to run after this task
      Returns:
      a task that runs the specified task after running this task.
    • handle

      default Runnable handle(Consumer<RuntimeException> handler)
      Returns a new runnable that delegates to the specified handler in the event of an exception.
      Parameters:
      handler - a runtime exception handler
      Returns:
      a new runnable that delegates to the specified handler in the event of an exception.
    • empty

      static Runnable empty()
      Returns an empty task.
      Returns:
      an empty task.
    • accept

      static <T> Runnable accept(Consumer<? super T> consumer, Supplier<? extends T> supplier)
      Returns a task that consumes a value from the specified supplier.
      Type Parameters:
      T - the consumed value
      Parameters:
      consumer - a consumer of the supplied value
      supplier - a supplier of the consumed value
      Returns:
      a task that consumes a value from the specified supplier.
    • runAll

      static Runnable runAll(Iterable<? extends Runnable> runners)
      Returns a composite runner that runs the specified runners.
      Parameters:
      runners - zero or more runners
      Returns:
      a composite runner that runs the specified runners, logging any exceptions