Java.util.function.LongBinaryOperator interface with Examples Last Updated : 18 Jul, 2019 Summarize Comments Improve Suggest changes Share 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: 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 . Java // Java program to demonstrate LongBinaryOperator import java.util.function.LongBinaryOperator; public class LongBinaryOperatorDemo { public static void main(String[] args) { LongBinaryOperator longBinaryOperator = (x, y) -> { return x + y; }; System.out.print("343666 + 547477 = "); System.out.println(longBinaryOperator .applyAsLong(343666, 547477)); LongBinaryOperator longBinaryOperator1 = (x, y) -> { return x * y; }; System.out.print("343666 * 547477 = "); System.out.println(longBinaryOperator1 .applyAsLong(343666, 547477)); } } Output: 343666 + 547477 = 891143 343666 * 547477 = 188149230682 Reference: https://docs.oracle.com/javase/8/docs/api/java/util/function/LongBinaryOperator.html Comment More infoAdvertise with us Next Article LongToIntFunction Interface in Java with Examples C CharchitKapoor Follow Improve Article Tags : Java Java - util package Java-Functional-Interfaces Practice Tags : Java Similar Reads Java.util.function.LongPredicate interface in Java with Examples The LongPredicate interface was introduced in JDK 8. This interface is packaged in java.util.function package. It operates on a long value and returns a predicate value based on a condition. It is a functional interface and thus can be used in lambda expression also. public interface LongPredicate M 2 min read LongToIntFunction Interface in Java with Examples The LongToIntFunction Interface is a part of the java.util.function package which has been introduced since Java 8, to implement functional programming in Java. It represents a function which takes in a long-valued argument and gives an int-valued result. The lambda expression assigned to an object 1 min read ToLongBiFunction Interface in Java with Examples The ToLongBiFunction Interface is a part of the java.util.function package which has been introduced since Java 8, to implement functional programming in Java. It represents a function which takes in two arguments of type T and U and produces an long-valued result. This functional interface takes in 2 min read Java.util.function.IntBinaryOperator interface with Examples The IntBinaryOperator interface was introduced in Java 8. It represents an operation on two int values and returns the result as an int 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 encapsula 2 min read LongFunction Interface in Java with Examples The LongFunction Interface is a part of the java.util.function package which has been introduced since Java 8, to implement functional programming in Java. It represents a function which takes in a long-valued argument and produces a result of type R. This functional interface takes in only one gene 1 min read LongConsumer Interface in Java with Examples The LongConsumer Interface is a part of the java.util.function package which has been introduced since Java 8, to implement functional programming in Java. It represents a function which takes in one long-valued argument but does not return any value. The lambda expression assigned to an object of L 3 min read Like