Java.util.function.LongBinaryOperator interface with Examples
The LongBinaryOperator interface was introduced in Java 8. It represents an operation on two long values and returns the result as a long value. It is a functional interface and thus can be used as a lambda expression or in a method reference. It is mostly used when the operation needs to be encapsulated from the user.
- applyAsLong(): This function takes two long values, performs the required operation and returns the result as a long.
public long applyAsLong(long val1, long val2)
Example to demonstrate LongBinaryOperator interface as a lambda expression .
343666 + 547477 = 891143 343666 * 547477 = 188149230682
Attention reader! Don’t stop learning now. Get hold of all the important Java Foundation and Collections concepts with the Fundamentals of Java and Java Collections Course at a student-friendly price and become industry ready. To complete your preparation from learning a language to DS Algo and many more, please refer Complete Interview Preparation Course.