In Java 8 the new package java.util.function contains a lot of functional interfaces. The documentation for that package (http://docs.oracle.com/javase/8/docs/api/java/util/function/package-summary.html) makes several references to "function shapes":
- There are several basic function shapes, including Function (unary function from T to R), Consumer (unary function from T to void), Predicate (unary function from T to boolean), and Supplier (nilary function to R).
- Function shapes have a natural arity based on how they are most commonly used. The basic shapes can be modified by an arity prefix to indicate a different arity, such as BiFunction (binary function from T and U to R).
- There are additional derived function shapes which extend the basic function shapes, including UnaryOperator (extends Function) and BinaryOperator (extends BiFunction).
I had never heard of the term "function shape" before, and I can barely find a reference to it anywhere except in the documentation above, but since that is Oracle's formal documentation on functional interfaces I'd like to understand it.
Can anyone provide a definition of "function shape", and invent an example? Is it a general term in Computer Science, or does it relate only to Java 8? And how is function shape related to a function descriptor (such as (T) -> boolean for the Predicate<T> interface)?
UPDATE The two comments below from Brian Goetz answer the questions I raised in this post.