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