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