@FunctionalInterface @API(status=STABLE, since="5.0") public interface ThrowingSupplier<T>
ThrowingSupplier is a functional interface that can be used to
implement any generic block of code that returns an object and
potentially throws a Throwable.
The ThrowingSupplier interface is similar to
Supplier, except that a ThrowingSupplier
can throw any kind of exception, including checked exceptions.
Throwable instead of ExceptionAlthough Java applications typically throw exceptions that are instances
of Exception, RuntimeException,
Error, or AssertionError (in testing
scenarios), there may be use cases where a ThrowingSupplier needs to
explicitly throw a Throwable. In order to support such specialized
use cases, get() is declared to throw Throwable.
| Modifier and Type | Method and Description |
|---|---|
T |
get()
Gets a result.
|