net.diversionmc.error.TryF Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of result Show documentation
Show all versions of result Show documentation
Diversion Network Result type.
package net.diversionmc.error;
import java.util.function.Function;
@FunctionalInterface
public interface TryF extends Function {
R tryApply(T t) throws E;
@SuppressWarnings("OverlyBroadCatchBlock")
default R apply(T t) {
try {
return tryApply(t);
} catch (Exception e) {
throw new ResultException(e);
}
}
static TryF of(Function f) {
return f::apply;
}
}