Interface Fn3<A,​B,​C,​R>

  • 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 Fn3<A,​B,​C,​R>
    A three-argument, exception-safe functional interface.
    • Method Summary

      All Methods Static Methods Instance Methods Abstract Methods Default Methods 
      Modifier and Type Method Description
      default R apply​(A a, B b, C c)
      The class that takes a consumer as an argument uses this convenience method so that it doesn't have to worry about checked exceptions either.
      R applyEx​(A a, B b, C c)
      Implement this one method and you don't have to worry about checked exceptions.
      static <A,​B,​C,​Z>
      Fn3<A,​B,​C,​Z>
      memoize​(Fn3<A,​B,​C,​Z> f)
      Use only on pure functions with no side effects.
    • Method Detail

      • applyEx

        R applyEx​(A a,
                  B b,
                  C c)
           throws Exception
        Implement this one method and you don't have to worry about checked exceptions.
        Throws:
        Exception
      • apply

        default R apply​(A a,
                        B b,
                        C c)
        The class that takes a consumer as an argument uses this convenience method so that it doesn't have to worry about checked exceptions either.
      • memoize

        static <A,​B,​C,​Z> Fn3<A,​B,​C,​Z> memoize​(Fn3<A,​B,​C,​Z> f)
        Use only on pure functions with no side effects. Wrap an expensive function with this and for each input value, the output will only be computed once. Subsequent calls with the same input will return identical output very quickly. Please note that the parameters to f need to implement equals() and hashCode() correctly for this to work correctly and quickly. Also, make sure your domain is very small! This function uses O(n^3) memory.