ExecutorService has two overloaded methods
ExecutorService.submit(Callable)
ExecutorService.submit(Runnable)
Instance of which class Runnable
or Callable
is created when I write the below code.
executor.submit(()->System.out.println("Running in : " + Thread.currentThread().getName()));
If this is an instance of Runnable
, how do I pass an instance of Callable
or vice-versa to ExecutorService
while using lambda expression?