Interface PureFunction<A,B>

Type Parameters:
A - the input type
B - the output type
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 PureFunction<A,B>
A function isomorphic to Function, but with the expectation that it is pure. It is obviously impossible to enforce this, so this interface exists purely as a marker to indicate intent.

Purity: We define a pure function as one that, given the same input, will always return the same output, and has no side effects (i.e., it does not modify any external state or interact with the outside world).

  • Method Summary

    Modifier and Type
    Method
    Description
    apply(A a)
    Applies this pure function to the given argument.
  • Method Details

    • apply

      @Contract(pure=true) B apply(A a)
      Applies this pure function to the given argument.
      Parameters:
      a - the function argument
      Returns:
      the function result