Too bad you can't just call functional interfaces in Java 8, or you could just do something like this:
BiFunction<BigDecimal, BigDecimal, BigDecimal> add = BigDecimal::add; add(x, y);
Unfortunately you have to do:
add.apply(x, y);
Which is kind of cumbersome.
Re:Why Go Is Not Good (2014)
by eveningcoffee on Wednesday December 09, 2015 @02:34PM
(#10706128)
Yes, it pretty much defeats the point. It would work if they had implemented a default method for an interface.
Unfortunately they brought something completely different in the name of Default Methods, and that was in my opinion not needed.
I comletelly agree with this, it is very confusing API.
You should even be able to do this in Java with "import static"
Yep, you should define a static methods add, sub, pow etc with BigDecimal parameters and then use import static.
Something along
class BigDecimalMath { public static BigDecimal add(BigDecimal x1, BigDecimal x2) { return x1.add(x2); } }
Also JVM JIT would very likely inline such code, so you should not really worry about an added method call.