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