Java — 8 | BiFunction, BiConsumer & BiPredicate Interface with Example

Amar Balu
The Fresh Writes
Published in
4 min readFeb 5, 2023

--

We all are aware of Java-8 Streams. In streams, we use certain functional interfaces to validate the Stream functionality.

Image Source : https://javadeveloperzone.com/spring-boot/spring-boot-tutorial/

In the previous blog we have discussed about Consumer, Predicate and Supplier Interfaces. You can refer to that here.

In this article, we discuss about some of the other functional Interfaces which are similar to Consumer, Supplier and Function Interface yet with a difference in the number of arguments being passed to the function.

Before moving further let me discuss about function Interface first.

Function Interface

This interface represents the format Function<T,R>.

Here the Parameter represents

T — the type of the input to the function
R — the type of the result of the function

It has the method apply<T t> which takes the argument of type T and returns the result of type R.

public class FunctionApp…

--

--

Amar Balu
The Fresh Writes

I'm a front-end developer. I love React and Redux, Java, and Data Science. I write code for fun!. Join our publication : https://medium.com/thefreshwrites