Speaking of Java-8, you can use the word “function” to mean a functional interface (an interface with a single abstract method), a class that implements such an interface, or an expression such as a functional interface (including an expression or Help lambda method). However, you should not name methods as functions. This becomes even more important than in previous versions of Java, as if you had seen the word “function” in a discussion related to Java-7, you could assume that “method” was meant. But in Java-8, people might think that you are talking about a functional interface, not a method.
So good to say:
The Stream.map method takes a function as a parameter.
or
InterfaceA Collector combines four functions: supplier, battery, totalizer and finisher.
or
I am passing an Objects::nonNull function to the Objects::nonNull method.
But the following would look strange:
I get a strange exception when I use the Math.sqrt function.
source share