- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How to implement ToIntBiFunction using lambda expression in Java?
ToIntBiFunction<T, U> is a built-in functional interface from java.util.function package. This interface accepts two parameters as input and produces an int-valued result. ToIntBiFunction<T, U> interface can be used as an assignment target for a lambda expression or method reference. It contains only one abstract method: applyAsInt() and doesn't contain any default or static methods.
Syntax
@FunctionalInterface interface ToIntBiFunction<T, U> { int applyAsInt(T t, U u); }
Example
import java.util.function.ToIntBiFunction; public class ToIntBiFunctionTest { public static void main(String args[]) { ToIntBiFunction<Integer, Integer> test = (t, u) -> t * u; System.out.println("The multiplication of t and u is: " + test.applyAsInt(10, 7)); System.out.println("The multiplication of t and u is: " + test.applyAsInt(8, 15)); } }
Output
The multiplication of t and u is: 70 The multiplication of t and u is: 120
- Related Articles
- How to implement IntBinaryOperator using lambda expression in Java?
- How to implement ToDoubleBiFunction using lambda expression in Java?
- How to implement ToLongFunction using lambda expression in Java?
- How to implement ToLongBiFunction using lambda expression in Java?
- How to implement DoubleToIntFunction using lambda expression in Java?
- How to implement DoubleToLongFunction using lambda expression in Java?
- How to implement PropertyChangeListener using lambda expression in Java?
- How to implement DoubleFunction using lambda expression in Java?
- How to implement ToDoubleFunction using lambda expression in Java?
- How to implement DoubleConsumer using lambda expression in Java?
- How to implement ObjLongConsumer interface using lambda expression in Java?
- How to implement the ObjIntConsumer interface using lambda expression in Java?
- How to implement the Fibonacci series using lambda expression in Java?
- How to implement the Runnable interface using lambda expression in Java?
- How to implement IntFunction with lambda expression in Java?

Advertisements