java - Is there a method reference in JDK for subtracting doubles? -
double::sum
method reference adding doubles, ie. (a,b) -> a+b
.
why there not method reference minus in jdk? i.e. (a,b) -> a-b
?
the primary purpose of methods double.sum
aid use cases reduction or arrays.parallelprefix
since minus not associative function, not appropriate use case.
adding 3rd party library dependencies sake of such simple method, not recommended. keep in mind, can create own method, if prefer named methods on lambda expressions.
e.g.
static double minus(double a, double b) { return a-b; }
and using myclass::minus
informative thirdpartyclass::minus
…
Comments
Post a Comment