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: 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 Interview Preparation For Software Developers C CharchitKapoor Follow Improve Article Tags : Java Java - util package Java-Functional-Interfaces Practice Tags : Java Similar Reads Interview PreparationInterview Preparation For Software DevelopersMust Coding Questions - Company-wise Must Do Coding Questions - Topic-wiseCompany-wise Practice ProblemsCompany PreparationCompetitive ProgrammingSoftware Design-PatternsCompany-wise Interview ExperienceExperienced - Interview ExperiencesInternship - Interview ExperiencesPractice @GeeksforgeeksProblem of the DayTopic-wise PracticeDifficulty Level - SchoolDifficulty Level - BasicDifficulty Level - EasyDifficulty Level - MediumDifficulty Level - HardLeaderboard !!Explore More...Data StructuresArraysLinked ListStackQueueBinary TreeBinary Search TreeHeapHashingGraphAdvance Data StructuresMatrixStringAll Data StructuresAlgorithmsAnalysis of AlgorithmsSearching AlgorithmsSorting AlgorithmsPattern SearchingGeometric AlgorithmsMathematical AlgorithmsRandomized AlgorithmsGreedy AlgorithmsDynamic ProgrammingDivide & ConquerBacktrackingBranch & BoundAll AlgorithmsProgramming LanguagesCC++JavaPythonC#Go LangSQLPHPScalaPerlKotlinWeb TechnologiesHTMLCSSJavaScriptBootstrapTailwind CSSAngularJSReactJSjQueryNodeJSPHPWeb DesignWeb BrowserFile FormatsComputer Science SubjectsOperating SystemsDBMSComputer NetworkComputer Organization & ArchitectureTOCCompiler DesignDigital Elec. & Logic DesignSoftware EngineeringEngineering MathematicsData Science & MLComplete Data Science CourseData Science TutorialMachine Learning TutorialDeep Learning TutorialNLP TutorialMachine Learning ProjectsData Analysis TutorialTutorial LibraryPython TutorialDjango TutorialPandas TutorialKivy TutorialTkinter TutorialOpenCV TutorialSelenium TutorialGATE CSGATE CS NotesGate CornerPrevious Year GATE PapersLast Minute Notes (LMNs)Important Topic For GATE CSGATE CoursePrevious Year Paper: CS exams Like