Open In App

Java.util.function.LongBinaryOperator interface with Examples

Last Updated : 12 Jul, 2025
Comments
Improve
Suggest changes
Like Article
Like
Report
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. Methods:
  1. 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 .
Output:
343666 + 547477 = 891143
343666 * 547477 = 188149230682
Reference: https://docs.oracle.com/javase/8/docs/api/java/util/function/LongBinaryOperator.html

Practice Tags :

Similar Reads