Example:
interface MyExecutor { void execute(Supplier> supplier); void execute(Callable> callable); }
Here, Supplier
and Callable
are functional interfaces
whose single abstract methods don’t take any parameters and return a non-void value.
As a result, the type of the lambda can’t be inferred at the call site unless an explicit cast is used.