
uk.co.probablyfine.dirty.utils.Exceptions Maven / Gradle / Ivy
package uk.co.probablyfine.dirty.utils;
public class Exceptions {
public interface ExceptionalSupplier {
public T get() throws E;
}
public interface ExceptionalVoid {
public void call() throws E;
}
public static T unchecked(ExceptionalSupplier supplier) {
try {
return supplier.get();
} catch (Exception e) {
throw new RuntimeException(e);
}
}
public static void unchecked(ExceptionalVoid supplier) {
try {
supplier.call();
} catch (Exception e) {
throw new RuntimeException(e);
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy