public final class CheckedLambdas
extends java.lang.Object
| Modifier and Type | Method and Description |
|---|---|
static <T,E extends java.lang.Exception> |
wrap(CheckedConsumer<T,E> consumer)
Wraps a
CheckedConsumer inside a Consumer and rethrow the
original exception. |
static <T,R,E extends java.lang.Exception> |
wrap(CheckedFunction<T,R,E> function)
Wraps a
CheckedFunction inside a Function and rethrow the
original exception. |
static <E extends java.lang.Exception> |
wrap(CheckedRunnable<E> runnable)
Wraps a
CheckedRunnable inside a Runnable and rethrow the
original exception. |
static <T,E extends java.lang.Exception> |
wrap(CheckedSupplier<T,E> supplier)
Wraps a
CheckedSupplier inside a Supplier and rethrow the
original exception. |
public static <T,E extends java.lang.Exception> java.util.function.Consumer<T> wrap(CheckedConsumer<T,E> consumer) throws E extends java.lang.Exception
CheckedConsumer inside a Consumer and rethrow the
original exception.T - the type for the consumer's parameter.E - the type for the checked exception.consumer - the Consumer to wrap.Consumer instance.E - the checked exception thrown in the lambda.E extends java.lang.Exceptionpublic static <E extends java.lang.Exception> java.lang.Runnable wrap(CheckedRunnable<E> runnable) throws E extends java.lang.Exception
CheckedRunnable inside a Runnable and rethrow the
original exception.E - the type for the checked exception.runnable - the Runnable to wrap.Runnable instance.E - the checked exception thrown in the lambda.E extends java.lang.Exceptionpublic static <T,E extends java.lang.Exception> java.util.function.Supplier<T> wrap(CheckedSupplier<T,E> supplier) throws E extends java.lang.Exception
CheckedSupplier inside a Supplier and rethrow the
original exception.T - the type for the supplier's parameter.E - the type for the checked exception.supplier - the Supplier to wrap.Supplier instance.E - the checked exception thrown in the lambda.E extends java.lang.Exceptionpublic static <T,R,E extends java.lang.Exception> java.util.function.Function<T,R> wrap(CheckedFunction<T,R,E> function) throws E extends java.lang.Exception
CheckedFunction inside a Function and rethrow the
original exception.T - the type for the function's parameter.R - the return type of the function.E - the type for the checked exception.function - the Function to wrap.Function instance.E - the checked exception thrown in the lambda.E extends java.lang.ExceptionCopyright © 2018 Frederic Thevenet. All rights reserved.