Interface ThrowingIntFunction<R,​E extends java.lang.Exception>

  • Type Parameters:
    R - the type of the result of the function
    E - the type of the thrown checked exception
    Functional Interface:
    This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

    @FunctionalInterface
    public interface ThrowingIntFunction<R,​E extends java.lang.Exception>
    Functional interface mirroring IntFunction for primitive ints from the java.util.function package. This allows wrapping a exceptions in a runtime exception: WrappedException

    As this adheres to the IntFunction interface, compose and andThen (as you might be familiar with from Function are not available.

    • Method Detail

      • apply

        R apply​(int i)
         throws E extends java.lang.Exception
        Throws:
        E extends java.lang.Exception
      • uncheck

        default java.util.function.IntFunction<R> uncheck()
      • unchecked

        static <R> java.util.function.IntFunction<R> unchecked​(ThrowingIntFunction<R,​?> f)
      • lifted

        static <R> java.util.function.IntFunction<java.util.Optional<R>> lifted​(ThrowingIntFunction<R,​?> f)
        Returns:
        a Function that returns the result of the given function as an Optional instance. In case of a failure, empty Optional is returned
      • sneaky

        static <R> java.util.function.IntFunction<R> sneaky​(ThrowingIntFunction<? extends R,​?> function)
      • lift

        default java.util.function.IntFunction<java.util.Optional<R>> lift()