R - return typeE - exception type@FunctionalInterface
public interface FragileFunction0<R,E extends java.lang.Exception>
| Modifier and Type | Method and Description |
|---|---|
R |
apply()
Run the function.
|
default Function0<R> |
nonFragile()
Convert this to a non-fragile function which does not throw a checked exception.
|
default Function0<R> |
nonFragile(R fallback)
Convert this to a non-fragile function which does not throw a checked exception.
|
default Function0<R> |
nonFragileX(java.util.function.Function<? super E,? extends R> exceptionHandler)
Convert this to a non-fragile function which does not throw a checked exception.
|
R apply() throws E extends java.lang.Exception
E - typed exceptionE extends java.lang.Exception@NotNull default Function0<R> nonFragile()
WrappedFragileException for any
checked exception thrown during apply().Function0.nonFragile(FragileFunction0)@NotNull default Function0<R> nonFragile(R fallback)
fallback value.
Please note that in this case the exception is completely lost!fallback - fallback valueFunction0.nonFragile(FragileFunction0, Object)@NotNull default Function0<R> nonFragileX(@NotNull java.util.function.Function<? super E,? extends R> exceptionHandler)
exceptionHandler - handler which can handle the exception how it sees fit.
E.g. throw an unchecked exception (compare nonFragile(),
return a fallback (compare nonFragile(Object)),
or do the latter but also log or collect the exceptionFunction0.nonFragileX(FragileFunction0, Function)