Top Description Fields Constructors Methods
org.jooq.lambda

public final Class Unchecked

extends Object
Class Inheritance
Imports
org.jooq.lambda.fi.util.function.*, org.jooq.lambda.fi.lang.CheckedRunnable, org.jooq.lambda.fi.util.CheckedComparator, org.jooq.lambda.fi.util.concurrent.CheckedCallable, java.io.IOException, .UncheckedIOException, java.util.Comparator, java.util.concurrent.Callable, java.util.function.*

Improved interoperability between checked exceptions and Java 8.

Checked exceptions are one of Java's biggest flaws. Due to backwards-compatibility, we're inheriting all the checked exception trouble back from JDK 1.0. This becomes even more obvious when using lambda expressions, most of which are not allowed to throw checked exceptions.

This library tries to ease some pain and wraps / unwraps a variety of API elements from the JDK 8 to improve interoperability with checked exceptions.

Author
Lukas Eder

Field Summary

Modifier and TypeField and Description
public static final Consumer<Throwable>
RETHROW_ALL

A Consumer that rethrows all exceptions, including checked exceptions.

public static final Consumer<Throwable>

Constructor Summary

AccessConstructor and Description
private
Unchecked()

No instances

Method Summary

Modifier and TypeMethod and Description
public static <T, U> BiConsumer<T, U>
public static <T, U> BiConsumer<T, U>
biConsumer(CheckedBiConsumer<T, U> consumer, Consumer<Throwable> handler)

Wrap a CheckedBiConsumer in a BiConsumer with a custom handler for checked exceptions.

public static <T, U, R> BiFunction<T, U, R>
public static <T, U, R> BiFunction<T, U, R>
biFunction(CheckedBiFunction<T, U, R> function, Consumer<Throwable> handler)

Wrap a CheckedBiFunction in a BiFunction with a custom handler for checked exceptions.

public static <T> BinaryOperator<T>
public static <T> BinaryOperator<T>
binaryOperator(CheckedBinaryOperator<T> operator, Consumer<Throwable> handler)

Wrap a CheckedBinaryOperator in a BinaryOperator with a custom handler for checked exceptions.

public static <T, U> BiPredicate<T, U>
public static <T, U> BiPredicate<T, U>
biPredicate(CheckedBiPredicate<T, U> predicate, Consumer<Throwable> handler)

Wrap a CheckedBiPredicate in a BiPredicate with a custom handler for checked exceptions.

public static BooleanSupplier
public static BooleanSupplier
booleanSupplier(CheckedBooleanSupplier supplier, Consumer<Throwable> handler)

Wrap a CheckedBooleanSupplier in a BooleanSupplier with a custom handler for checked exceptions.

public static <T> Callable<T>
public static <T> Callable<T>
callable(CheckedCallable<T> callable, Consumer<Throwable> handler)

Wrap a CheckedCallable<T> in a Callable<T> with a custom handler for checked exceptions.

public static <T> Comparator<T>
public static <T> Comparator<T>
comparator(CheckedComparator<T> comparator, Consumer<Throwable> handler)

Wrap a CheckedComparator in a Comparator with a custom handler for checked exceptions.

public static <T> Consumer<T>
public static <T> Consumer<T>
consumer(CheckedConsumer<T> consumer, Consumer<Throwable> handler)

Wrap a CheckedConsumer in a Consumer with a custom handler for checked exceptions.

public static DoubleBinaryOperator
public static DoubleBinaryOperator
doubleBinaryOperator(CheckedDoubleBinaryOperator operator, Consumer<Throwable> handler)

Wrap a CheckedDoubleBinaryOperator in a DoubleBinaryOperator with a custom handler for checked exceptions.

public static DoubleConsumer
public static DoubleConsumer
doubleConsumer(CheckedDoubleConsumer consumer, Consumer<Throwable> handler)

Wrap a CheckedDoubleConsumer in a DoubleConsumer with a custom handler for checked exceptions.

public static <R> DoubleFunction<R>
public static <R> DoubleFunction<R>
doubleFunction(CheckedDoubleFunction<R> function, Consumer<Throwable> handler)

Wrap a CheckedDoubleFunction in a DoubleFunction with a custom handler for checked exceptions.

public static DoublePredicate
public static DoublePredicate
doublePredicate(CheckedDoublePredicate function, Consumer<Throwable> handler)

Wrap a CheckedDoublePredicate in a DoublePredicate with a custom handler for checked exceptions.

public static DoubleSupplier
public static DoubleSupplier
doubleSupplier(CheckedDoubleSupplier supplier, Consumer<Throwable> handler)

Wrap a CheckedDoubleSupplier in a DoubleSupplier with a custom handler for checked exceptions.

public static DoubleToIntFunction
public static DoubleToIntFunction
doubleToIntFunction(CheckedDoubleToIntFunction function, Consumer<Throwable> handler)

Wrap a CheckedDoubleToIntFunction in a DoubleToIntFunction with a custom handler for checked exceptions.

public static DoubleToLongFunction
public static DoubleToLongFunction
doubleToLongFunction(CheckedDoubleToLongFunction function, Consumer<Throwable> handler)

Wrap a CheckedDoubleToLongFunction in a DoubleToLongFunction with a custom handler for checked exceptions.

public static DoubleUnaryOperator
public static DoubleUnaryOperator
doubleUnaryOperator(CheckedDoubleUnaryOperator operator, Consumer<Throwable> handler)

Wrap a CheckedDoubleUnaryOperator in a DoubleUnaryOperator with a custom handler for checked exceptions.

public static <T, R> Function<T, R>
function(CheckedFunction<T, R> function)

Wrap a CheckedFunction in a Function.

public static <T, R> Function<T, R>
function(CheckedFunction<T, R> function, Consumer<Throwable> handler)

Wrap a CheckedFunction in a Function with a custom handler for checked exceptions.

public static IntBinaryOperator
public static IntBinaryOperator
intBinaryOperator(CheckedIntBinaryOperator operator, Consumer<Throwable> handler)

Wrap a CheckedIntBinaryOperator in a IntBinaryOperator with a custom handler for checked exceptions.

public static IntConsumer
public static IntConsumer
intConsumer(CheckedIntConsumer consumer, Consumer<Throwable> handler)

Wrap a CheckedIntConsumer in a IntConsumer with a custom handler for checked exceptions.

public static <R> IntFunction<R>
public static <R> IntFunction<R>
intFunction(CheckedIntFunction<R> function, Consumer<Throwable> handler)

Wrap a CheckedIntFunction in a IntFunction with a custom handler for checked exceptions.

public static IntPredicate
public static IntPredicate
intPredicate(CheckedIntPredicate function, Consumer<Throwable> handler)

Wrap a CheckedPredicate in a IntPredicate with a custom handler for checked exceptions.

public static IntSupplier
public static IntSupplier
intSupplier(CheckedIntSupplier supplier, Consumer<Throwable> handler)

Wrap a CheckedIntSupplier in a IntSupplier with a custom handler for checked exceptions.

public static IntToDoubleFunction
public static IntToDoubleFunction
intToDoubleFunction(CheckedIntToDoubleFunction function, Consumer<Throwable> handler)

Wrap a CheckedIntToDoubleFunction in a IntToDoubleFunction with a custom handler for checked exceptions.

public static IntToLongFunction
public static IntToLongFunction
intToLongFunction(CheckedIntToLongFunction function, Consumer<Throwable> handler)

Wrap a CheckedIntToLongFunction in a IntToLongFunction with a custom handler for checked exceptions.

public static IntUnaryOperator
public static IntUnaryOperator
intUnaryOperator(CheckedIntUnaryOperator operator, Consumer<Throwable> handler)

Wrap a CheckedIntUnaryOperator in a IntUnaryOperator with a custom handler for checked exceptions.

public static LongBinaryOperator
public static LongBinaryOperator
longBinaryOperator(CheckedLongBinaryOperator operator, Consumer<Throwable> handler)

Wrap a CheckedLongBinaryOperator in a LongBinaryOperator with a custom handler for checked exceptions.

public static LongConsumer
public static LongConsumer
longConsumer(CheckedLongConsumer consumer, Consumer<Throwable> handler)

Wrap a CheckedLongConsumer in a LongConsumer with a custom handler for checked exceptions.

public static <R> LongFunction<R>
public static <R> LongFunction<R>
longFunction(CheckedLongFunction<R> function, Consumer<Throwable> handler)

Wrap a CheckedLongFunction in a LongFunction with a custom handler for checked exceptions.

public static LongPredicate
public static LongPredicate
longPredicate(CheckedLongPredicate function, Consumer<Throwable> handler)

Wrap a CheckedLongPredicate in a LongPredicate with a custom handler for checked exceptions.

public static LongSupplier
public static LongSupplier
longSupplier(CheckedLongSupplier supplier, Consumer<Throwable> handler)

Wrap a CheckedLongSupplier in a LongSupplier with a custom handler for checked exceptions.

public static LongToDoubleFunction
public static LongToDoubleFunction
longToDoubleFunction(CheckedLongToDoubleFunction function, Consumer<Throwable> handler)

Wrap a CheckedLongToDoubleFunction in a LongToDoubleFunction with a custom handler for checked exceptions.

public static LongToIntFunction
public static LongToIntFunction
longToIntFunction(CheckedLongToIntFunction function, Consumer<Throwable> handler)

Wrap a CheckedLongToIntFunction in a LongToIntFunction with a custom handler for checked exceptions.

public static LongUnaryOperator
public static LongUnaryOperator
longUnaryOperator(CheckedLongUnaryOperator operator, Consumer<Throwable> handler)

Wrap a CheckedLongUnaryOperator in a LongUnaryOperator with a custom handler for checked exceptions.

public static <T> ObjDoubleConsumer<T>
public static <T> ObjDoubleConsumer<T>
objDoubleConsumer(CheckedObjDoubleConsumer<T> consumer, Consumer<Throwable> handler)

Wrap a CheckedObjDoubleConsumer in a ObjDoubleConsumer with a custom handler for checked exceptions.

public static <T> ObjIntConsumer<T>
public static <T> ObjIntConsumer<T>
objIntConsumer(CheckedObjIntConsumer<T> consumer, Consumer<Throwable> handler)

Wrap a CheckedObjIntConsumer in a ObjIntConsumer with a custom handler for checked exceptions.

public static <T> ObjLongConsumer<T>
public static <T> ObjLongConsumer<T>
objLongConsumer(CheckedObjLongConsumer<T> consumer, Consumer<Throwable> handler)

Wrap a CheckedObjLongConsumer in a ObjLongConsumer with a custom handler for checked exceptions.

public static <T> Predicate<T>
public static <T> Predicate<T>
predicate(CheckedPredicate<T> function, Consumer<Throwable> handler)

Wrap a CheckedPredicate in a Predicate with a custom handler for checked exceptions.

public static Runnable
public static Runnable
runnable(CheckedRunnable runnable, Consumer<Throwable> handler)

Wrap a CheckedRunnable in a Runnable with a custom handler for checked exceptions.

public static <T> Supplier<T>
public static <T> Supplier<T>
supplier(CheckedSupplier<T> supplier, Consumer<Throwable> handler)

Wrap a CheckedSupplier in a Supplier with a custom handler for checked exceptions.

public static void
throwChecked(Throwable t)

"sneaky-throw" a checked exception or throwable.

public static <T, U> ToDoubleBiFunction<T, U>
public static <T, U> ToDoubleBiFunction<T, U>
toDoubleBiFunction(CheckedToDoubleBiFunction<T, U> function, Consumer<Throwable> handler)

Wrap a CheckedToDoubleBiFunction in a ToDoubleBiFunction with a custom handler for checked exceptions.

public static <T> ToDoubleFunction<T>
public static <T> ToDoubleFunction<T>
toDoubleFunction(CheckedToDoubleFunction<T> function, Consumer<Throwable> handler)

Wrap a CheckedToDoubleFunction in a ToDoubleFunction with a custom handler for checked exceptions.

public static <T, U> ToIntBiFunction<T, U>
public static <T, U> ToIntBiFunction<T, U>
toIntBiFunction(CheckedToIntBiFunction<T, U> function, Consumer<Throwable> handler)

Wrap a CheckedToIntBiFunction in a ToIntBiFunction with a custom handler for checked exceptions.

public static <T> ToIntFunction<T>
public static <T> ToIntFunction<T>
toIntFunction(CheckedToIntFunction<T> function, Consumer<Throwable> handler)

Wrap a CheckedToIntFunction in a ToIntFunction with a custom handler for checked exceptions.

public static <T, U> ToLongBiFunction<T, U>
public static <T, U> ToLongBiFunction<T, U>
toLongBiFunction(CheckedToLongBiFunction<T, U> function, Consumer<Throwable> handler)

Wrap a CheckedToLongBiFunction in a ToLongBiFunction with a custom handler for checked exceptions.

public static <T> ToLongFunction<T>
public static <T> ToLongFunction<T>
toLongFunction(CheckedToLongFunction<T> function, Consumer<Throwable> handler)

Wrap a CheckedToLongFunction in a ToLongFunction with a custom handler for checked exceptions.

public static <T> UnaryOperator<T>
public static <T> UnaryOperator<T>
unaryOperator(CheckedUnaryOperator<T> operator, Consumer<Throwable> handler)

Wrap a CheckedUnaryOperator in a UnaryOperator with a custom handler for checked exceptions.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait