Interface Callable<T>

Type Parameters:
T - the result type
All Superinterfaces:
Callable<T>

public interface Callable<T> extends Callable<T>
An enhanced callable.
Author:
Paul Ferraro
  • Method Summary

    Modifier and Type
    Method
    Description
    default <R> Callable<R>
    map(Function<T,R> mapper)
    Returns a callable whose result is mapped by the specified function.
    static Callable<Void>
    of(Runnable runner)
    Returns a callable that runs the specified runner and returns null.
    static <T> Callable<T>
    of(Supplier<T> supplier)
    Returns a callable that delegates to the specified supplier.
    static <T> Callable<T>
    of(T value)
    Returns a callable that returns the specified value.

    Methods inherited from interface java.util.concurrent.Callable

    call
  • Method Details

    • map

      default <R> Callable<R> map(Function<T,R> mapper)
      Returns a callable whose result is mapped by the specified function.
      Type Parameters:
      R - the mapped result type
      Parameters:
      mapper - a mapping function
      Returns:
      a callable whose result is mapped by the specified function.
    • of

      static Callable<Void> of(Runnable runner)
      Returns a callable that runs the specified runner and returns null.
      Parameters:
      runner - a runner
      Returns:
      a callable that runs the specified runner and returns null.
    • of

      static <T> Callable<T> of(Supplier<T> supplier)
      Returns a callable that delegates to the specified supplier.
      Parameters:
      supplier - a supplier
      Returns:
      the result of the specified supplier.
    • of

      static <T> Callable<T> of(T value)
      Returns a callable that returns the specified value.
      Parameters:
      value - the result value
      Returns:
      a callable that returns the specified value.