Package cpw.mods.modlauncher.api
Class LambdaExceptionUtils
java.lang.Object
cpw.mods.modlauncher.api.LambdaExceptionUtils
From stackoverflow: https://stackoverflow.com/a/27644392
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interface
static interface
static interface
static interface
static interface
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic <T,
U, E extends Exception>
BiConsumer<T, U> rethrowBiConsumer
(LambdaExceptionUtils.BiConsumer_WithExceptions<T, U, E> biConsumer) rethrowConsumer
(LambdaExceptionUtils.Consumer_WithExceptions<T, E> consumer) .forEach(rethrowConsumer(name -> System.out.println(Class.forName(name)))); or .forEach(rethrowConsumer(ClassNameUtil::println));rethrowFunction
(LambdaExceptionUtils.Function_WithExceptions<T, R, E> function) .map(rethrowFunction(name -> Class.forName(name))) or .map(rethrowFunction(Class::forName))rethrowSupplier
(LambdaExceptionUtils.Supplier_WithExceptions<T, E> function) rethrowSupplier(() -> new StringJoiner(new String(new byte[]{77, 97, 114, 107}, "UTF-8"))),private static <E extends Throwable>
voidthrowAsUnchecked
(Exception exception) static <T,
R, E extends Exception>
Runcheck
(LambdaExceptionUtils.Function_WithExceptions<T, R, E> function, T t) uncheck(Class::forName, "xxx");static void
uncheck(() -> Class.forName("xxx"));static <R,
E extends Exception>
Runcheck
(LambdaExceptionUtils.Supplier_WithExceptions<R, E> supplier) uncheck(() -> Class.forName("xxx"));
-
Constructor Details
-
LambdaExceptionUtils
public LambdaExceptionUtils()
-
-
Method Details
-
rethrowConsumer
public static <T,E extends Exception> Consumer<T> rethrowConsumer(LambdaExceptionUtils.Consumer_WithExceptions<T, E> consumer) .forEach(rethrowConsumer(name -> System.out.println(Class.forName(name)))); or .forEach(rethrowConsumer(ClassNameUtil::println)); -
rethrowBiConsumer
public static <T,U, BiConsumer<T,E extends Exception> U> rethrowBiConsumer(LambdaExceptionUtils.BiConsumer_WithExceptions<T, U, E> biConsumer) -
rethrowFunction
public static <T,R, Function<T,E extends Exception> R> rethrowFunction(LambdaExceptionUtils.Function_WithExceptions<T, R, E> function) .map(rethrowFunction(name -> Class.forName(name))) or .map(rethrowFunction(Class::forName)) -
rethrowSupplier
public static <T,E extends Exception> Supplier<T> rethrowSupplier(LambdaExceptionUtils.Supplier_WithExceptions<T, E> function) rethrowSupplier(() -> new StringJoiner(new String(new byte[]{77, 97, 114, 107}, "UTF-8"))), -
uncheck
uncheck(() -> Class.forName("xxx")); -
uncheck
public static <R,E extends Exception> R uncheck(LambdaExceptionUtils.Supplier_WithExceptions<R, E> supplier) uncheck(() -> Class.forName("xxx")); -
uncheck
public static <T,R, R uncheckE extends Exception> (LambdaExceptionUtils.Function_WithExceptions<T, R, E> function, T t) uncheck(Class::forName, "xxx"); -
throwAsUnchecked
- Throws:
E
-