Package - java.util.function


Well you know predicate, function and consumer can only accept one input argument but sometimes we need a two-argument type functional interface in that situation we can use these predefined functional interfaces.


  1. BiPredicate
  2. BiFunction
  3. BiConsumer
BiPredicate: It is the same as a predicate interface but the only difference is it takes two input arguments to perform a conditional check.

1
2
3
 interface BiPredicate<T,U> {
public boolean test(T t, U u);
}


BiFunction: It is the same as a function predefine functional interface but the only difference is it takes two input arguments to perform some operation.

1
2
3
 interface BiFunction<T,U,R> {
public R apply(T t, U u);
}


BiConsumer: BiConsumer is exactly the same as Consumer except that it will take 2 input arguments

1
2
3
 interface BiConsumer<T,U> {
public void accept(T t, U u);
}





Share this

Related Posts

1 comments:

Write comments
23 May 2020 at 12:41 delete

please add videos of spring cloud

Reply
avatar

EmoticonEmoticon

:)
:(
=(
^_^
:D
=D
=)D
|o|
@@,
;)
:-bd
:-d
:p
:ng