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