I have question regarding some existing working code that looks something like this:
@Autowired
ThreadPoolTaskExecutor executor;
Future<T> someMethod (Supplier<T> supplier){
Future<T> future = executor.submit(supplier::get);
}
I checked the submit() method for ThreadPoolTaskExecutor class, the signature like this:
Future<T> submit(Callable<T> task)
But in the code instead of passing in a callable, it is passing in the get() method. Why is it accepted? are methods that return results callables? I googled this but didn't find any results.
Could someone explain? Thanks.