public class FunctionalUtils extends Object
| Modifier and Type | Class and Description |
|---|---|
static interface |
FunctionalUtils.ExceptionThrowingFunction<T,R>
Equivalent of
Function that throws a checked exception. |
| Constructor and Description |
|---|
FunctionalUtils() |
| Modifier and Type | Method and Description |
|---|---|
static <T,R> java.util.function.Function<T,R> |
safeFunction(FunctionalUtils.ExceptionThrowingFunction<T,R> unsafeFunc)
Takes a functional interface that throws an exception and returns a
Function that deals with that exception by
wrapping in a runtime exception. |
public static <T,R> java.util.function.Function<T,R> safeFunction(FunctionalUtils.ExceptionThrowingFunction<T,R> unsafeFunc)
Function that deals with that exception by
wrapping in a runtime exception. Useful for APIs that use the standard Java functional interfaces that don't throw checked
exceptions.T - InputR - OutputunsafeFunc - Functional interface that throws checked exception.Function that handles checked exception.Copyright © 2022. All rights reserved.