From this answer I learned that the only difference between Callable
and Runnable
is that former can return a result of the execution and throw an exception.
I don't understand why Executor
doesn't define a method which takes a Callable
:
void execute(Callable command);
From my point of view, it'd be logical to create methods for both Runnable
and Callable
. In ExecutorService
, which is a subinterface of Executor
, there are similar submit()
methods for both Runnable
and Callable
.
Please, explain this design decision, because I can't find any explanation on the Internet.