-
- Type Parameters:
T
- the type of items supplied by this supplier
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
@FunctionalInterface public interface UncheckedSupplier<T>
Represents a supplier of items.The supplier can throw
Exceptions
.
-
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description static <T> UncheckedSupplier<T>
from(java.util.function.Supplier<T> supplier)
Creates a newUncheckedSupplier
from an existingSupplier
T
get()
Gets an item.default java.util.function.Supplier<T>
toSupplier()
-
-
-
Method Detail
-
from
static <T> UncheckedSupplier<T> from(java.util.function.Supplier<T> supplier)
Creates a newUncheckedSupplier
from an existingSupplier
- Type Parameters:
T
- the type of items supplied by this supplier- Parameters:
supplier
- the supplier- Returns:
- the new
UncheckedSupplier
-
get
T get() throws java.lang.Exception
Gets an item.- Returns:
- an item
- Throws:
java.lang.Exception
- if anything wrong happen
-
toSupplier
default java.util.function.Supplier<T> toSupplier()
- Returns:
- the
Supplier
getting the item produced by thisUncheckedSupplier
. If an exception is thrown during the production, this exception is rethrown, wrapped into aRuntimeException
if needed.
-
-