Java 8 Predicate, Function, Chaining, Predicate Joining interview questions (Live Demo) Code Decode

preview_player
Показать описание
In this video of code decode we have covered Java 8 || Predicate || Function || Chaining || Predicate Joining interview questions (Live Demo)

Udemy Course of Code Decode on Microservice k8s AWS CICD link:

Course Description Video :

here are lots of new features which were added in Java 8. Here is the list of important features which are mostly asked as java 8 interview questions:

Lambda Expression
Stream API
Default methods in the interface
Predicate
Functional Interface
Optional
Method references
Date API
Nashorn, JavaScript Engine

Main advantages of using Java 8?
More compact code
Less boiler plate code
More readable and reusable code
More testable code
Parallel operations

Q) What are predicates?
Predicate is a predefined Functional Interface (Having only 1 abstract method).
The only abstract method of predicate is test(T t):
public boolean test(T t);
Whenever we want to check some boolean condition then you can go for Predicates.

Q) How to use Predicates?
Say if you need to test if the length of the given string is greater than or equal to 5. Then in such situations where you need to test conditions, use test() method of predicate.

Q) Type parameter and return types of Predicates?
Input to predicate can be anything like
Hence only 1 type argument is required which is input type in predicate.
Return type is not required as its always Boolean only.

Q) Advantages of Predicates?
Code Reusability

Conditional checks are holded by Functional interfaces.

Q) What is Predicate joining?
You can combine predicates in serial predicate

Three ways to join :
And
Or
Negate

Eg if you want to test 2 conditions:
To check length of string
To check if length is even.

Q) What are Functions
Function is also a predefined Functional Interface (Having only 1 abstract method).

The only abstract method of Function is apply(T t);

R apply(T t);

Given some input perform some operation on input and then produce / return result (not necessary a boolean value).

This takes 1 input and returns one output.
In predicate we used to take 1 input and return type is always boolean.
In function return type is not fixed hence we declare both input type and return type.

Q) What is Functional chaining

We can combine / chain multiple functions together with andThen .

There are two ways to combine functions:

Multiple functions can be chained together like :

-------------------------------------------------------------------------------------------------------------------------------------

Code Decode Playlists

-------------------------------------------------------------------------------------------------------------------------------------
Subscriber and Follow Code Decode

--------------------------------------------------------------------------------------------------------------------------------------

#java8InterviewQuestions #java8newfeatures #java8
Рекомендации по теме
Комментарии
Автор

I have saved each of your playlist, I keep on playing them all day. Thankyou for such amazing contribution, can't wait to support this channel monetarily .

gyanprakash
Автор

Guys this is my first comment in YouTube and I must say this channel is awesome. I am working in a IT company and these videos are real gold. Thank you so much and please bring more of this content 😊👌

prajjvalrajvanshi
Автор

Like your excitement and passion that you explain. You teach the concepts with simple, easy to understand examples. God bless you Mam !

kbhoyi
Автор

Earlier when i tried to learn predicate and functions it looks very complicated to me, but after watching your tutorial it looks to be simple thing. Your way of explaining it awesome.

shubhisharma
Автор

I am going through all your java 8 videos since today morning . Your explanation is really clear with code so that even the difficult topic seems easy. Great job . Thanks 🙏

Priya_
Автор

Thank you so much for your patience and for explaining each and every minute detail very clearly.

sureshgarine
Автор

Hi code decode it's so nice to see all videos at one place with clear explanation while preparing for interview, can you please share the PPT which you are explaining in this series.

venkatarakesh
Автор

Best channel till date...last time you helped me in my selection around 2 years back..

and now i am here again for the prep of next journey...

jain_sahil
Автор

This channel provides a better Explanation than courses available on PluralSight. Thanks for video

sumeetsapla
Автор

Very useful video to understand about predicate and function 👍

duraisinghjebastin
Автор

Hi @Code Decode, thank you so much for the effort for these content.. It would have been great if could share these slides with us.

poojarenake
Автор

What a crystal clear explanation!! Thanks a lot for sharing knowledge 👏

sivakirankakileti
Автор

Thank you for such clear explanation of these java 8 features along with easy to understand examples.

soumyadas
Автор

Appreciate your Great efforts in providing very useful topics. looking forward to seeing other topics as well like collections, threads, spring and rest

mekalayellaiah
Автор

Very good explanation best channel to preparing for interview . Thank you

rajatram
Автор

Very interested to see the video. Please upload more video for our technical knowledge meanwhile I will inform my all friend to suggest who need technical knowledge

johnpeter
Автор

Thanks for sharing the Java 8 features and the way explained concepts are really understandable.

OmSriUdayaKumarGade
Автор

Helps to understand easily and expecting a video on other functional interfaces soon
Thanks

karthikeyanu
Автор

Thanks for the amazing content, we love you!!

AkarshKollepara
Автор

Thanks for the awesome videos with nice explanation. You would have put lot of effort..👍

sudhakarmallampati