@FunctionalInterface public interface ThrowingDoubleSupplier extends DoubleSupplier
double-valued results, possibly throwing an exception.| Modifier and Type | Method and Description |
|---|---|
default DoubleSupplier |
fallbackTo(DoubleSupplier fallback)
Returns a
DoubleSupplier returning from the given supplier if this supplier throws an exception. |
default DoubleSupplier |
fallbackTo(DoubleSupplier fallback,
Consumer<Exception> exceptionConsumer)
Returns a
DoubleSupplier returning from the given supplier if this supplier throws an exception. |
default double |
getAsDouble()
Returns a result.
|
double |
getAsDoubleThrowing()
Returns a result.
|
default DoubleSupplier |
orReturn(double value)
Returns a
DoubleSupplier returning the given value if this supplier throws an exception. |
default DoubleSupplier |
orReturn(double value,
Consumer<Exception> exceptionConsumer)
Returns a
DoubleSupplier returning the given value if this supplier throws an exception. |
default ThrowingDoubleSupplier |
orThrow(Class<? extends RuntimeException> exceptionClass)
Returns a
ThrowingDoubleSupplier throwing an exception of the given type if this supplier throws an exception. |
default ThrowingDoubleSupplier |
orThrow(Class<? extends RuntimeException> exceptionClass,
String message)
Returns a
ThrowingDoubleSupplier throwing an exception of the given type if this supplier throws an exception. |
default ThrowingDoubleSupplier |
orTryWith(ThrowingDoubleSupplier other)
Returns a
ThrowingDoubleSupplier returning from the given supplier if this supplier throws an exception. |
default ThrowingDoubleSupplier |
orTryWith(ThrowingDoubleSupplier other,
Consumer<Exception> exceptionConsumer)
Returns a
ThrowingDoubleSupplier returning from the given supplier if this supplier throws an exception. |
default DoubleSupplier fallbackTo(DoubleSupplier fallback)
DoubleSupplier returning from the given supplier if this supplier throws an exception.IllegalArgumentException - if fallback is nulldefault DoubleSupplier fallbackTo(DoubleSupplier fallback, Consumer<Exception> exceptionConsumer)
DoubleSupplier returning from the given supplier if this supplier throws an exception.IllegalArgumentException - if fallback is nulldefault double getAsDouble()
UncheckedException.getAsDouble in interface DoubleSupplierdouble getAsDoubleThrowing()
throws Exception
Exceptiondefault DoubleSupplier orReturn(double value)
DoubleSupplier returning the given value if this supplier throws an exception.default DoubleSupplier orReturn(double value, Consumer<Exception> exceptionConsumer)
DoubleSupplier returning the given value if this supplier throws an exception.default ThrowingDoubleSupplier orThrow(Class<? extends RuntimeException> exceptionClass)
ThrowingDoubleSupplier throwing an exception of the given type if this supplier throws an exception.
The original exception thrown by this supplier 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 ThrowingDoubleSupplier orThrow(Class<? extends RuntimeException> exceptionClass, String message)
ThrowingDoubleSupplier throwing an exception of the given type if this supplier throws an exception.
The original exception thrown by this supplier 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 ThrowingDoubleSupplier orTryWith(ThrowingDoubleSupplier other)
ThrowingDoubleSupplier returning from the given supplier if this supplier throws an exception.IllegalArgumentException - if other is nulldefault ThrowingDoubleSupplier orTryWith(ThrowingDoubleSupplier other, Consumer<Exception> exceptionConsumer)
ThrowingDoubleSupplier returning from the given supplier if this supplier throws an exception.IllegalArgumentException - if other is null