- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
@FunctionalInterface @API(status=STABLE, since="5.0") public interface Executable
Executableis a functional interface that can be used to implement any generic block of code that potentially throws a
Executable interface is similar to
except that an
Executable can throw any kind of exception.
Rationale for throwing
Throwable instead of
Although Java applications typically throw exceptions that are instances
AssertionError (in testing
scenarios), there may be use cases where an
Executable needs to
explicitly throw a
Throwable. In order to support such specialized
execute() is declared to throw