@FunctionalInterface public interface ThrowingDoubleFunction<R> extends DoubleFunction<R>
double-valued argument and produces a result, possibly throwing an exception.| Modifier and Type | Method and Description |
|---|---|
default R |
apply(double argument)
Applies this function to the given argument.
|
R |
applyThrowing(double argument)
Applies this function to the given argument.
|
default DoubleFunction<R> |
fallbackTo(DoubleFunction<R> fallback)
Returns a
DoubleFunction applying the given function to the argument if this function throws an exception. |
default DoubleFunction<R> |
fallbackTo(DoubleFunction<R> fallback,
Consumer<Exception> exceptionConsumer)
Returns a
DoubleFunction applying the given function to the argument if this function throws an exception. |
default DoubleFunction<R> |
orReturn(R value)
Returns a
DoubleFunction returning the given value if this function throws an exception. |
default DoubleFunction<R> |
orReturn(R value,
Consumer<Exception> exceptionConsumer)
Returns a
DoubleFunction returning the given value if this function throws an exception. |
default ThrowingDoubleFunction<R> |
orThrow(Class<? extends RuntimeException> exceptionClass)
Returns a
ThrowingDoubleFunction throwing an exception of the given type if this function throws an exception. |
default ThrowingDoubleFunction<R> |
orThrow(Class<? extends RuntimeException> exceptionClass,
String message)
Returns a
ThrowingDoubleFunction throwing an exception of the given type if this function throws an exception. |
default ThrowingDoubleFunction<R> |
orTryWith(ThrowingDoubleFunction<? extends R> other)
Returns a
ThrowingDoubleFunction applying the given function to the argument if this function throws an exception. |
default ThrowingDoubleFunction<R> |
orTryWith(ThrowingDoubleFunction<? extends R> other,
Consumer<Exception> exceptionConsumer)
Returns a
ThrowingDoubleFunction applying the given function to the argument if this function throws an exception. |
default R apply(double argument)
UncheckedException.apply in interface DoubleFunction<R>R applyThrowing(double argument) throws Exception
Exceptiondefault DoubleFunction<R> fallbackTo(DoubleFunction<R> fallback)
DoubleFunction applying the given function to the argument if this function throws an exception.IllegalArgumentException - if fallback is nulldefault DoubleFunction<R> fallbackTo(DoubleFunction<R> fallback, Consumer<Exception> exceptionConsumer)
DoubleFunction applying the given function to the argument if this function throws an exception.IllegalArgumentException - if fallback is nulldefault DoubleFunction<R> orReturn(R value)
DoubleFunction returning the given value if this function throws an exception.default DoubleFunction<R> orReturn(R value, Consumer<Exception> exceptionConsumer)
DoubleFunction returning the given value if this function throws an exception.default ThrowingDoubleFunction<R> orThrow(Class<? extends RuntimeException> exceptionClass)
ThrowingDoubleFunction throwing an exception of the given type if this function throws an exception.
The original exception thrown by this function is the cause of the thrown exception.
The exception class must have a constructor accepting a single Throwable as an argument.
IllegalArgumentException - if exceptionClass is nulldefault ThrowingDoubleFunction<R> orThrow(Class<? extends RuntimeException> exceptionClass, String message)
ThrowingDoubleFunction throwing an exception of the given type if this function throws an exception.
The original exception thrown by this function is the cause of the thrown exception.
The exception class must have a constructor accepting String and Throwable as arguments.
IllegalArgumentException - if exceptionClass is nulldefault ThrowingDoubleFunction<R> orTryWith(ThrowingDoubleFunction<? extends R> other)
ThrowingDoubleFunction applying the given function to the argument if this function throws an exception.IllegalArgumentException - if other is nulldefault ThrowingDoubleFunction<R> orTryWith(ThrowingDoubleFunction<? extends R> other, Consumer<Exception> exceptionConsumer)
ThrowingDoubleFunction applying the given function to the argument if this function throws an exception.IllegalArgumentException - if other is null