Let's Understand famous Java interview Questions | Comparable vs Comparator with Example
Vložit
- čas přidán 9. 07. 2024
- In this video we will learn what is difference between Comparator and Comparable in java with practical example.
00:00 Introduction to Video
01:07 Understand The Context : About Collection and Group of Objects
04:56 Understanding of Sorting Objects in Collection[Comparator and Comparable]
Telegram Link for Doubt: t.me/learncodewithdurgesh
Important Videos:
➡️React JS with Project : • 🔥 🔥 Complete React Js ...
➡️Learn JDBC in one video: • JDBC Crash Course in 1...
➡️Learn Python in One Video: • Learn Python in One Vi...
➡️Learn HTML in one video: • Jquery in one video in...
➡️Learn HTML form in one video: • Jquery in one video in...
➡️Learn JavaScript in one videos: • Learn JavaScript in O...
➡️Learn Form Validation using javascript and jquery: • Form Validation using ...
➡️Learn CSS in one video: • Jquery in one video in...
➡️Jquery in one video: • Jquery in one video in...
Kotlin is one video: • Kotlin | Learn Kotlin ...
➡️Complete Python Project - CZcams downloader in one video: • Jquery in one video in...
Important Playlist:
➡️Spring Boot Tutorial with Project : • Spring Boot Tutorial i...
➡️Spring MVC Tutorial: • Spring MVC Tutorial St...
➡️Complete Spring Framework Tutorial: • Spring Framework Tutor...
➡️Hibernate Tutorials: • Hibernate Tutorial for...
➡️E-Commerce Project using Java: • E-Commerce Project usi...
➡️AWS Free Java Hosting Playlist: • AWS Hosting Tutorial |...
➡️Hibernate Tutorial Playlist: • Hibernate Tutorial for...
➡️Learn Technology in One Vides: • Learn in one video : C...
➡️Programming Tips for Programmers: • Coding Tips and Discus...
➡️Complete Python for Beginners: • Complete Python Tutori...
➡️Important Python Projects: • Python Projects in Hindi
➡️Complete Servlet & JSP : • Servlet and Jsp (Serve...
➡️Complete JDBC ( Java Database Connectivity) : • JDBC(Java Database Con...
➡️Complete Java Project : TechBlog: • Full Java Advance Pro...
➡️Java Swing Projects: • Java Projects for begi...
➡️Java Core Concepts: • Java Core Tutorial
➡️Kya aap Jante hai Series: • kya app jante hai : s...
Important Links:
👉Official Website (Source Code): learncodewithdurgesh.com/
👉Telegram Discussion Group: t.me/learncodewithdurgesh
👉Follow me on Instagram: / durgesh_k_t
👉Follow on Facebook / learncodewithdurgesh
Disclaimer:
All videos are for educational purposes and use them wisely. Any video may have a slight mistake, please take decisions based on your research. This video is not forcing anything on you.
Yes please make a series of Java interview questions with answer.
Yes sir please add
Finally ,I understand the detail concept of Comparator & Comparable. thankyou so much sir.
Thank you sir may God make your channel of 1 million subscribers because youtube tutors like you tech us that things that we can never learn by paying Thanks again❤️
Sir, bhut sare videos dkehle iske, pr apne jo explain kia hai, vaisa clear duniya mai koi ni kr sakta...hath jod kr thanks apko
Thanks Sir. Please provide more of such interview videos!
hello bro what should i learn for java gui for android , do we have to design like html and css through code ? i have seen video where they just have select the view like button etc.
Yes sir we need a series of interviews for java
Thankyou so much! Very well explained. ✌
mast laga sir apka teaching style aur samjhane ka tarika thank You Sir
We can also say comparable use for default natural sorting order and comparator for custumomized
Sir u r incredible😊 Thanks for clearing my concepts
very helpful for interview point of view
great video. thanks .
Thanks a lot for clearing this confusion
Best Ever video, easy explanation
No one gives this in depth insight in simple language, Thanks @LearnWithDurgesh
So clearly explained
I had been asked also this question, Make a video on 'serialization' also sir this is also very frequent asked question in interview
yes yes, Yes please make a series of Java interview questions with answer.
Thanks a lot sir.. Nicely explained.... Please make a playlist of java interview questions.
Hi Durgesh
Thanks a lot for the valuable content you share,
Could you please make one video on concurrent hashmap + locking mechanism
Ha sir ji ese video chahiye
You explain difficult concepts in a very simple way
@Thank you Durgesh, it is an excellent explanation of Comparator and Comparable, please add steam of Comparator and if possible Comparable
You are great Sir!!!!
Most wanted channel learnWithDurgesh in social media.
Thank you so much bhai
I had doubts regarding this one since long time
really helpful
Very helpful video 🙏🙏🙏🙏🙏❤️❤️❤️❤️❤️❤️❤️
yes sir makes the interview questions...
Yes make a series of interview questions with answers
Thank you so much
Yes sir please make a interview series
Great learning
Thank you so much sir
we need a series of interviews for java . please make a series
Thanku so much for video ,it really helpfull
Plz make video on java interview question
Thanks bro😊
Thank you sir
very nice explanation
Thank you
Sir we want these type of example more Please do sir....
Thank you sir 😊
Have seen many comparable and comparator videos. M sure this is best. But u could have included the reverse sorting or multiple sorting ways also.
wow, so well explained , make videos in all imp topics sir pls
Its very important for interview session please make some video on interview
Sir, I have faced this topic in my last interview
Great
Good one.
Sir how to fix this problem" communication link failure " in eclipse
thanks sir
Sir plz continue this series
make videos on on concurrent multithreding like executor framework and java 11 features
Durgesh bhai is GOAT❤️💖💕
If there is another list inside the emp object. Then how we will compare it.
Please make video on String vs String buffer vs String builder with example.
THANK U SIR
Thank you so muchhh sir, for this informative concept.. I was too confused in between comparable and comparator and watching videos on CZcams makes more confusion in my mind.. Like where to implement comparable when to call, how to print by using StringTo, exact difference between comparable n comparator.. Now I am clear with everything like from basic.. Bus mujhe voh (o1.marks - o2.marks); kaise run hota samjha naii I mean kaise compare hota kon chota kon bada n running process samjhi nai.. Baki sab clear
When - value is returned then it means the object 2 is greater than the object 1 and when + value is returned then it means the object 1 is greater than object 2, there is nothing more than that in it.
It's common sense, I mean if you subtract two values and you get negative results then it is obvious that the value one was smaller otherwise why would you have gotten a negative value as the result?
great make series on this
Amazing❤❤❤❤❤❤
Most appropriate answer when to use Comparable and when to use Comparator is :
If object class (on which you want to do sorting ex : Emp.java is this video) is in your control, then you can use Comparable.
If object class is not in your control, means you are using some 3rd party API to get data, or you are some library, it means you cant modify code of that object class, the you can use Comparator interface.
please make more such videos bhaiya thank you.👦🏻
Sirji plz make video on how treemap works internally. Java
Sir please make video on hashcode and equals internal implementation
Please make the videos on Comparator and Comparable..
How to sort string in comparable and long in comparator?
Love diz vdeoo
Yes Sir Please make some releted vdo
Please also make video on hibernate,Spring Boot, microservices interview question and answers
Please make a series of java interview questions
Sir Please make the series of interview questions
east or west Durgesh bhaiya is the best
Continue sir
What is mean by current object and Emp Obj in this compare To method ,you can focus on this by taking example ...sir
Plz series of interview questions
I tried in the interview, the interviewer gave me conceptuals questions and i was not selected...
Thank you Durgesh Bhaijaan for providing such types of videos
Abhi kya kare ho
please make a video on singleton class
Bro can you tell me how we use this methods in quiz. Means if i want to prepare a mcq type quiz how should we apply these methods to compare options to answer and this is how we get marks as well.. so can you please make video on this please ?
Sir can you please make this video using java 8... most of the interviewers ask this nowadays how to use comparator, comparable using java 8
By using Java 8 all you want is to have lamba functions for overriding the functions of this comparable and comparator function interface.
Else there is no difference.
Lamba functions are pretty easy to understand.
Please make one more project on java using servlet and jsp
Bhaiya ,pls Java interview series for the experience
Please make java interview questions series
Can we compare multiple fields in one call, something like collection.sort(emps , new IdCompare , new name Compare)
Is there any alternative way to compare multiple fields in one call?
There's no point in comparing multiple fields, just think about that, at any given time you'll have to use one field only if you want to sort. For example how can you sort something by both name and id?
Either you'd want that to be sorted by name or by id.
Please make series
Please explain compareTo and comparator with one more example.
Please make video on java project in intellij idea please bro
Bhai ""serializable"" concept pe video bana do please... Asaan bhasha me.
Supb
can you please make a series on kafka
❤❤❤
Sir logical question kaisa puchha jaata hai ...uska v video upload kariyega naa aap
one video for equals and hashcode also..
cobinely for equals hashcode and '==' operator
Spring security par topic wise video bana sakte hai kya
How can I connect with you?
Comparator with name sorting is not working
Bhai interview video banóo
Class main apna khuda ka custom sort karna hoga toh apko compareable ko implement karna padega .
Not understood the concept of Comparator
Still are you unclear??
allah tumhe islam ki toufeeq de.
Such a poor explanation, didn't understood
Such a poor brain 🧠 couldn't understand such simple logic
Can any one explain me this “this.empid - o.empid ”
Thanks sir😍