@FunctionalInterface public interface ThrowingToDoubleFunction<T> extends ToDoubleFunction<T>
double-valued result, possibly throwing an exception.| Modifier and Type | Method and Description |
|---|---|
default double |
applyAsDouble(T argument)
Applies this function to the given argument.
|
double |
applyAsDoubleThrowing(T argument)
Applies this function to the given argument.
|
default ToDoubleFunction<T> |
fallbackTo(ToDoubleFunction<T> fallback)
Returns a
ToDoubleFunction applying the given function to the argument if this function throws an exception. |
default ToDoubleFunction<T> |
fallbackTo(ToDoubleFunction<T> fallback,
Consumer<Exception> exceptionConsumer)
Returns a
ToDoubleFunction applying the given function to the argument if this function throws an exception. |
default ToDoubleFunction<T> |
orReturn(double value)
Returns a
ToDoubleFunction returning the given value if this function throws an exception. |
default ToDoubleFunction<T> |
orReturn(double value,
Consumer<Exception> exceptionConsumer)
Returns a
ToDoubleFunction returning the given value if this function throws an exception. |
default ThrowingToDoubleFunction<T> |
orThrow(Class<? extends RuntimeException> exceptionClass)
Returns a
ThrowingToDoubleFunction throwing an exception of the given type if this function throws an exception. |
default ThrowingToDoubleFunction<T> |
orThrow(Class<? extends RuntimeException> exceptionClass,
String message)
Returns a
ThrowingToDoubleFunction throwing an exception of the given type if this function throws an exception. |
default ThrowingToDoubleFunction<T> |
orTryWith(ThrowingToDoubleFunction<? super T> other)
Returns a
ThrowingToDoubleFunction applying the given function to the argument if this function throws an exception. |
default ThrowingToDoubleFunction<T> |
orTryWith(ThrowingToDoubleFunction<? super T> other,
Consumer<Exception> exceptionConsumer)
Returns a
ThrowingToDoubleFunction applying the given function to the argument if this function throws an exception. |
default double applyAsDouble(T argument)
UncheckedException.applyAsDouble in interface ToDoubleFunction<T>double applyAsDoubleThrowing(T argument) throws Exception
Exceptiondefault ToDoubleFunction<T> fallbackTo(ToDoubleFunction<T> fallback)
ToDoubleFunction applying the given function to the argument if this function throws an exception.IllegalArgumentException - if fallback is nulldefault ToDoubleFunction<T> fallbackTo(ToDoubleFunction<T> fallback, Consumer<Exception> exceptionConsumer)
ToDoubleFunction applying the given function to the argument if this function throws an exception.IllegalArgumentException - if fallback is nulldefault ToDoubleFunction<T> orReturn(double value)
ToDoubleFunction returning the given value if this function throws an exception.default ToDoubleFunction<T> orReturn(double value, Consumer<Exception> exceptionConsumer)
ToDoubleFunction returning the given value if this function throws an exception.default ThrowingToDoubleFunction<T> orThrow(Class<? extends RuntimeException> exceptionClass)
ThrowingToDoubleFunction 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 ThrowingToDoubleFunction<T> orThrow(Class<? extends RuntimeException> exceptionClass, String message)
ThrowingToDoubleFunction 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 ThrowingToDoubleFunction<T> orTryWith(ThrowingToDoubleFunction<? super T> other)
ThrowingToDoubleFunction applying the given function to the argument if this function throws an exception.IllegalArgumentException - if other is nulldefault ThrowingToDoubleFunction<T> orTryWith(ThrowingToDoubleFunction<? super T> other, Consumer<Exception> exceptionConsumer)
ThrowingToDoubleFunction applying the given function to the argument if this function throws an exception.IllegalArgumentException - if other is null