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