net.diversionmc.error.TryS 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.Supplier;
@FunctionalInterface
public interface TryS extends Supplier {
T tryGet() throws E;
@SuppressWarnings("OverlyBroadCatchBlock")
default T get() {
try {
return tryGet();
} catch (Exception e) {
throw new ResultException(e);
}
}
static TryS of(Supplier f) {
return f::get;
}
}