I want to create a generic method where i can pass below BinaryOperatior as a parameter in the method for Arithmetic operation based on binary operator parameter do the arithmetic operation and then return the result but I am getting error like Ambiguous, both 'multiply(BigDecimal)' and 'multiply(BigDecimal, MathContext)' match
I know this error come because overloaded method inside Bigdecimal for multiply, subtract, etc but how to solve this problem or how can i use this?
BinaryOperator ao1= BigDecimal::subtract;
BinaryOperator ao2= BigDecimal::multiply;
See below images attached for referance:
Pleas help how can do this? Thanks in advance!