Package com.glitchybyte.glib.function
Interface GSupplierWithException<T>
- Type Parameters:
T- Type of result 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.
Represents a supplier of results that can throw an exception.
-
Method Summary
Modifier and TypeMethodDescriptionget()Gets a result.static <T> TgetOrDefault(GSupplierWithException<T> supplier, T defaultValue) Get value from supplier or default if there is an exception.static <T> TgetOrNull(GSupplierWithException<T> supplier) Get value from supplier or null if there is an exception.
-
Method Details
-
get
Gets a result.- Returns:
- A result.
- Throws:
Exception- Some exception.
-
getOrDefault
Get value from supplier or default if there is an exception.- Type Parameters:
T- Type of value.- Parameters:
supplier- Value supplier.defaultValue- Default value if there is an exception.- Returns:
- Value from supplier or default if there is an exception.
-
getOrNull
Get value from supplier or null if there is an exception.- Type Parameters:
T- Type of value.- Parameters:
supplier- Value supplier.- Returns:
- Value from supplier or null if there is an exception.
-