filmov
tv
Java 8 Interview Questions And Answers | Consumer || BiConsumer || Supplier || Chaining (Live Demo)
Показать описание
Java 8 part 4 New Features Interview Questions And Answers Live Demo
Udemy Course of Code Decode on Microservice k8s AWS CICD link:
Course Description Video :
Java 8 Interview Questions Complete Playlist :
Consumer : It will consume Item. Consumers never return anything (never supply), they just consume.
Consumer Chaining :
We can combine / chain multiple consumers together with andThen .
There is only one ways to combine consumers:
No compose() in consumer.
Multiple consumers can be chained together like :
Supplier :
It will just supply required objects and will not take any input
Its always going to supply never consume / take any input.
EG : always supply me current date.
No chaining as no input is given to this. Only it gives u output.
Advantages:
Write once, use anywhere.
Code Reusability
BiCinsumer Bisupplier :
What if we need 2 arguments for operation?
Then we need Bi XYZ Functional Interfaces.
There is no input in supplier so no 1 or 2 Input arguments needed. Hence no BiSupplier.
Q) If we want to operate on 3 arguments then triPredicate?
There are no TriPredicate or TriFunction etc.
No QuadPredicate No QuadFunction.
Java 8 has inbuilt Functional interfaces that can take only 1 or 2 arguments no more.
-------------------------------------------------------------------------------------------------------------------------------------
Code Decode Playlists
-------------------------------------------------------------------------------------------------------------------------------------
Subscriber and Follow Code Decode
--------------------------------------------------------------------------------------------------------------------------------------
#Java8 #Java8Consumer #Java8Supplier #codedecode
Udemy Course of Code Decode on Microservice k8s AWS CICD link:
Course Description Video :
Java 8 Interview Questions Complete Playlist :
Consumer : It will consume Item. Consumers never return anything (never supply), they just consume.
Consumer Chaining :
We can combine / chain multiple consumers together with andThen .
There is only one ways to combine consumers:
No compose() in consumer.
Multiple consumers can be chained together like :
Supplier :
It will just supply required objects and will not take any input
Its always going to supply never consume / take any input.
EG : always supply me current date.
No chaining as no input is given to this. Only it gives u output.
Advantages:
Write once, use anywhere.
Code Reusability
BiCinsumer Bisupplier :
What if we need 2 arguments for operation?
Then we need Bi XYZ Functional Interfaces.
There is no input in supplier so no 1 or 2 Input arguments needed. Hence no BiSupplier.
Q) If we want to operate on 3 arguments then triPredicate?
There are no TriPredicate or TriFunction etc.
No QuadPredicate No QuadFunction.
Java 8 has inbuilt Functional interfaces that can take only 1 or 2 arguments no more.
-------------------------------------------------------------------------------------------------------------------------------------
Code Decode Playlists
-------------------------------------------------------------------------------------------------------------------------------------
Subscriber and Follow Code Decode
--------------------------------------------------------------------------------------------------------------------------------------
#Java8 #Java8Consumer #Java8Supplier #codedecode
Комментарии