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