The Callable
and Supplier
functional interfaces in java.util.concurrent
and java.util.function
packages respectively have the
For Runnable
and Callable
, they've been parts of the concurrent package since Java 6. It implies that both of them are ready to be submitted to an Executor
and run asynchronously. Here Callable
has a specific usage.
While for Runnable
(0 in 0 out), Supplier
(0 in 1 out), Consumer
(1 in 0 out) and Function
(1 in 1 out), they've been parts of the functional feature since Java 8. All of them are ready to be handled by something lambda friendly, like CompletableFuture
. Here Supplier
just means a function without any input param but has a return value, which is highly abstract.