Function type naming conventions

Tim Peierls tim at peierls.net
Wed Jan 23 13:22:27 PST 2013


On Wed, Jan 23, 2013 at 3:34 PM, Remi Forax <forax at univ-mlv.fr> wrote:

> >   UnaryOperator<T> extends Function<T,T>
> >   BinaryOperator<T> extends BiFunction<T,T,T>
>
> UnaryOperator should be Operator and BinaryOperator should be BiOperator,
> it's just more regular.
>
> Operator<T> extends Function<T,T>
> BiOperator<T> extends BiFunction<T,T,T>
>

The reason to have these "convenience" types in the first place is so
they'll be easy to remember and recognize. The term "function" is much more
commonly used to mean "function of one argument", so Function/BiFunction is
better than UnaryFunction/BinaryFunction. The term "operator" skew more
evenly between unary and binary, so UnaryOperator/BinaryOperator is better
than Operator/BiOperator.

--tim


More information about the lambda-libs-spec-observers mailing list