Let's Understand famous Java interview Questions | Comparable vs Comparator with Example

แชร์
ฝัง
  • เผยแพร่เมื่อ 2 ต.ค. 2024

ความคิดเห็น • 113

  • @share_analysis
    @share_analysis 2 ปีที่แล้ว +3

    Finally ,I understand the detail concept of Comparator & Comparable. thankyou so much sir.

  • @vedpandey2951
    @vedpandey2951 2 ปีที่แล้ว +32

    Yes please make a series of Java interview questions with answer.

  • @vikas_roy_v1
    @vikas_roy_v1 2 ปีที่แล้ว +3

    I had been asked also this question, Make a video on 'serialization' also sir this is also very frequent asked question in interview

  • @ajeetchouksey1167
    @ajeetchouksey1167 2 ปีที่แล้ว

    Best Ever video, easy explanation
    No one gives this in depth insight in simple language, Thanks @LearnWithDurgesh

  • @yaqubfarooqui8431
    @yaqubfarooqui8431 7 หลายเดือนก่อน

    Most wanted channel learnWithDurgesh in social media.

  • @abhishekpawar114
    @abhishekpawar114 2 ปีที่แล้ว +1

    Sir we want these type of example more Please do sir....

  • @crackit5472
    @crackit5472 2 ปีที่แล้ว +1

    Yes sir we need a series of interviews for java

  • @Anonymous-14567-o
    @Anonymous-14567-o 2 ปีที่แล้ว +9

    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❤️

  • @sachinmankotia2291
    @sachinmankotia2291 2 ปีที่แล้ว +10

    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.

  • @sagarghodekar5745
    @sagarghodekar5745 2 ปีที่แล้ว +1

    Sirji plz make video on how treemap works internally. Java

  • @raghavgupta6446
    @raghavgupta6446 2 ปีที่แล้ว

    Thanks a lot for clearing this confusion

  • @palakgupta2959
    @palakgupta2959 2 ปีที่แล้ว +3

    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

    • @sabkaBaap007
      @sabkaBaap007 ปีที่แล้ว +1

      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.

  • @gayatrimungarwadi2477
    @gayatrimungarwadi2477 2 หลายเดือนก่อน

    Very nice...

  • @java8992
    @java8992 2 ปีที่แล้ว

    Sir logical question kaisa puchha jaata hai ...uska v video upload kariyega naa aap

  • @pahadsingh3709
    @pahadsingh3709 ปีที่แล้ว

    Ha sir ji ese video chahiye

  • @faizanabbas839
    @faizanabbas839 2 ปีที่แล้ว

    We can also say comparable use for default natural sorting order and comparator for custumomized

  • @swapniljagatap3533
    @swapniljagatap3533 ปีที่แล้ว

    Thank you so much

  • @ganavin3423
    @ganavin3423 3 หลายเดือนก่อน

    great video. thanks .

  • @rohitsingh2k
    @rohitsingh2k 2 ปีที่แล้ว

    please make more such videos bhaiya thank you.👦🏻

  • @teluram8760
    @teluram8760 2 ปีที่แล้ว

    Yes Sir Please make some releted vdo

  • @kiranthakur5046
    @kiranthakur5046 3 หลายเดือนก่อน

    Thanks bro😊

  • @mdshadabalam6453
    @mdshadabalam6453 2 ปีที่แล้ว

    Good one.

  • @yashjadhav6157
    @yashjadhav6157 2 ปีที่แล้ว

    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 ?

  • @indrajeetjyoti9020
    @indrajeetjyoti9020 2 ปีที่แล้ว +1

    make videos on on concurrent multithreding like executor framework and java 11 features

  • @vivekbhore5722
    @vivekbhore5722 2 ปีที่แล้ว

    THANK U SIR

  • @dhiranshukeswani8822
    @dhiranshukeswani8822 ปีที่แล้ว +1

    Hi Durgesh
    Thanks a lot for the valuable content you share,
    Could you please make one video on concurrent hashmap + locking mechanism

  • @suchetapawar7540
    @suchetapawar7540 2 ปีที่แล้ว

    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?

    • @sabkaBaap007
      @sabkaBaap007 ปีที่แล้ว +2

      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.

  • @All_In_786
    @All_In_786 2 ปีที่แล้ว +2

    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

  • @shivampathak1405
    @shivampathak1405 ปีที่แล้ว

    east or west Durgesh bhaiya is the best

  • @ashishkumarsrivastav9106
    @ashishkumarsrivastav9106 ปีที่แล้ว +1

    Great learning

  • @sandeepnalawade6886
    @sandeepnalawade6886 11 หลายเดือนก่อน

    Please make video on String vs String buffer vs String builder with example.

  • @Iimran786
    @Iimran786 ปีที่แล้ว

    What is mean by current object and Emp Obj in this compare To method ,you can focus on this by taking example ...sir

  • @HaiderAli-xy9wb
    @HaiderAli-xy9wb 11 หลายเดือนก่อน

    Please also make video on hibernate,Spring Boot, microservices interview question and answers

  • @YogeshPatil-xs4sw
    @YogeshPatil-xs4sw 9 หลายเดือนก่อน

    @Thank you Durgesh, it is an excellent explanation of Comparator and Comparable, please add steam of Comparator and if possible Comparable

  • @Jk-tr1fb
    @Jk-tr1fb 2 ปีที่แล้ว +1

    Sir, I have faced this topic in my last interview

  • @anshgandhi5757
    @anshgandhi5757 5 หลายเดือนก่อน

    Thank you so much bhai
    I had doubts regarding this one since long time
    really helpful

  • @sanjeevpandit7305
    @sanjeevpandit7305 ปีที่แล้ว

    Comparator with name sorting is not working

  • @priyankavishwakarma4266
    @priyankavishwakarma4266 2 หลายเดือนก่อน

    Thank u ,it was easy to understand by your explanation.

  • @asifahmed4313
    @asifahmed4313 ปีที่แล้ว

    please make a video on singleton class

  • @mursalimansari1558
    @mursalimansari1558 2 ปีที่แล้ว

    Sir please make video on hashcode and equals internal implementation

  • @tejasvinikalpande6715
    @tejasvinikalpande6715 2 ปีที่แล้ว

    Thanku so much for video ,it really helpfull
    Plz make video on java interview question

  • @shaifalisrivastava951
    @shaifalisrivastava951 ปีที่แล้ว

    Please make the videos on Comparator and Comparable..

  • @Rohit-dj2lm
    @Rohit-dj2lm 2 ปีที่แล้ว

    Sir how to fix this problem" communication link failure " in eclipse

  • @neeleshmohanty7380
    @neeleshmohanty7380 2 ปีที่แล้ว

    Please make series

  • @Neha-il3xi
    @Neha-il3xi 6 หลายเดือนก่อน

    Thanks sir😍

  • @Vikas-yo3jj
    @Vikas-yo3jj 2 ปีที่แล้ว

    Please make video on java project in intellij idea please bro

  • @rohanpatel3115
    @rohanpatel3115 2 ปีที่แล้ว

    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.

  • @avinashsahu8057
    @avinashsahu8057 ปีที่แล้ว

    Please make a series of java interview questions

  • @umeshtiwari3057
    @umeshtiwari3057 ปีที่แล้ว

    Please explain compareTo and comparator with one more example.

  • @VishalSingh-uw4ne
    @VishalSingh-uw4ne 2 ปีที่แล้ว

    Supb

  • @TheChi100
    @TheChi100 2 ปีที่แล้ว

    If there is another list inside the emp object. Then how we will compare it.

  • @ajeetchouksey1167
    @ajeetchouksey1167 2 ปีที่แล้ว

    Please make java interview questions series

  • @palashpullarwar2581
    @palashpullarwar2581 2 ปีที่แล้ว

    Bhai ""serializable"" concept pe video bana do please... Asaan bhasha me.

  • @kumarinidhi90
    @kumarinidhi90 2 ปีที่แล้ว

    Thanks a lot sir.. Nicely explained.... Please make a playlist of java interview questions.

  • @swastinsahoo2397
    @swastinsahoo2397 2 ปีที่แล้ว

    Class main apna khuda ka custom sort karna hoga toh apko compareable ko implement karna padega .

  • @yatendra__singh
    @yatendra__singh 2 ปีที่แล้ว

    Bhaiya ,pls Java interview series for the experience

  • @syedfaizan5841
    @syedfaizan5841 7 หลายเดือนก่อน

    ❤❤❤

  • @nileshgitte9279
    @nileshgitte9279 2 ปีที่แล้ว

    Its very important for interview session please make some video on interview

  • @mayankkhajure3398
    @mayankkhajure3398 2 ปีที่แล้ว

    Please make one more project on java using servlet and jsp

  • @borntocode555
    @borntocode555 ปีที่แล้ว

    Love diz vdeoo

  • @pranshu_bisht
    @pranshu_bisht ปีที่แล้ว

    Sir u r incredible😊 Thanks for clearing my concepts

  • @AnilPatel-ox1jw
    @AnilPatel-ox1jw 2 ปีที่แล้ว

    Spring security par topic wise video bana sakte hai kya

  • @navneettripathi2110
    @navneettripathi2110 2 ปีที่แล้ว

    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.

  • @mayankshrivastava9046
    @mayankshrivastava9046 2 ปีที่แล้ว

    yes yes, Yes please make a series of Java interview questions with answer.

  • @nivesharyal70
    @nivesharyal70 2 ปีที่แล้ว

    How to sort string in comparable and long in comparator?

  • @rraajjeesshh06279
    @rraajjeesshh06279 ปีที่แล้ว

    Such a poor explanation, didn't understood

    • @GeekyCoder170
      @GeekyCoder170 8 หลายเดือนก่อน

      Such a poor brain 🧠 couldn't understand such simple logic

  • @payalpanjwani5332
    @payalpanjwani5332 2 ปีที่แล้ว

    Thankyou so much! Very well explained. ✌

  • @misalmncomps
    @misalmncomps 2 ปีที่แล้ว

    yes sir makes the interview questions...

  • @shreyasvaghasia7175
    @shreyasvaghasia7175 2 ปีที่แล้ว

    wow, so well explained , make videos in all imp topics sir pls

  • @elfish_aru
    @elfish_aru 2 ปีที่แล้ว

    can you please make a series on kafka

  • @RandomClicksBy
    @RandomClicksBy 2 ปีที่แล้ว

    Sir plz continue this series

  • @WorldOfMotivation09
    @WorldOfMotivation09 2 หลายเดือนก่อน

    Amazing explanation

  • @baibhavkumar4743
    @baibhavkumar4743 2 ปีที่แล้ว

    Bhai interview video banóo

  • @shahabu_java
    @shahabu_java 8 หลายเดือนก่อน

    mast laga sir apka teaching style aur samjhane ka tarika thank You Sir

  • @udaypatil7195
    @udaypatil7195 2 ปีที่แล้ว

    Sir Please make the series of interview questions

  • @RahulPatel-uh6zk
    @RahulPatel-uh6zk 2 ปีที่แล้ว

    Very helpful video 🙏🙏🙏🙏🙏❤️❤️❤️❤️❤️❤️❤️

  • @vishalsonwane4374
    @vishalsonwane4374 2 ปีที่แล้ว

    How can I connect with you?

  • @soumyadebbasu7882
    @soumyadebbasu7882 2 ปีที่แล้ว

    Thanks Sir. Please provide more of such interview videos!

  • @aakashdetwal4866
    @aakashdetwal4866 ปีที่แล้ว

    very nice explanation

  • @mindbehaviour9195
    @mindbehaviour9195 2 ปีที่แล้ว

    Durgesh bhai is GOAT❤️💖💕

  • @ghosh9390
    @ghosh9390 2 ปีที่แล้ว

    Plz series of interview questions

  • @purushottamshisode3661
    @purushottamshisode3661 2 ปีที่แล้ว

    great make series on this

  • @RandomClicksBy
    @RandomClicksBy 2 ปีที่แล้ว

    Sir plz continue this series

  • @miteshbarnwal8239
    @miteshbarnwal8239 ปีที่แล้ว

    You explain difficult concepts in a very simple way

  • @prateekkk4880
    @prateekkk4880 ปีที่แล้ว

    Not understood the concept of Comparator

  • @riyamaji8350
    @riyamaji8350 6 หลายเดือนก่อน

    So clearly explained

  • @CompIT0597
    @CompIT0597 2 ปีที่แล้ว

    Thank you sir

  • @ashishdhule6797
    @ashishdhule6797 2 ปีที่แล้ว

    Yes make a series of interview questions with answers

  • @mdumarreza3072
    @mdumarreza3072 2 ปีที่แล้ว

    Thank you so much sir

  • @SandeepKumar-so2st
    @SandeepKumar-so2st 2 ปีที่แล้ว

    Continue sir

  • @debiprasaddash654
    @debiprasaddash654 2 ปีที่แล้ว

    Yes sir please make a interview series

  • @kumardebyashish8295
    @kumardebyashish8295 2 ปีที่แล้ว

    we need a series of interviews for java . please make a series

  • @bhuvneshkumarsharma7671
    @bhuvneshkumarsharma7671 2 ปีที่แล้ว

    thanks sir

  • @tonmoykhan5737
    @tonmoykhan5737 2 ปีที่แล้ว

    Thank you

  • @photo_lab4095
    @photo_lab4095 2 ปีที่แล้ว

    very helpful for interview point of view

  • @kshitijbansal3672
    @kshitijbansal3672 ปีที่แล้ว

    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

  • @priyankabachhav5315
    @priyankabachhav5315 2 ปีที่แล้ว

    Thank you so muchhh sir, for this informative concept.. I was too confused in between comparable and comparator and watching videos on TH-cam 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

    • @sabkaBaap007
      @sabkaBaap007 ปีที่แล้ว +1

      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.

    • @sabkaBaap007
      @sabkaBaap007 ปีที่แล้ว

      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?

  • @saritaprasad4295
    @saritaprasad4295 2 ปีที่แล้ว

    You are great Sir!!!!

  • @ketank6864
    @ketank6864 ปีที่แล้ว

    Amazing❤❤❤❤❤❤

  • @dipankargarai2727
    @dipankargarai2727 2 ปีที่แล้ว

    Thank you sir 😊