How To Sort Objects Using Comparator Interface

Поділитися
Вставка
  • Опубліковано 20 жов 2024

КОМЕНТАРІ • 21

  • @jakobkahf7064
    @jakobkahf7064 4 роки тому +2

    the easiest way to make the Job done, thanks dude !

  • @ianfarai4982
    @ianfarai4982 6 років тому +2

    Nice video you really made me understand how this interface works

  • @victorpazb
    @victorpazb 5 років тому +3

    Really helpful!
    Thanks!

  • @lucacadei7712
    @lucacadei7712 2 роки тому

    Thank u bro u saved my life

  • @qulaeygaming5202
    @qulaeygaming5202 Рік тому

    Than you mr java made easy

  • @mackensonreginaldmichel399
    @mackensonreginaldmichel399 3 роки тому +1

    Thansk a lot, but I don;t know when to use Comparator and when to use Comparable

  • @jvsnyc
    @jvsnyc 4 роки тому +2

    In modern versions of Java, calling the instance method of sort() on the specific collection item you wish to sort may be more optimized. Collections.sort() will always work correctly but may not work as efficiently in some cases.

  • @shashankdaksh7554
    @shashankdaksh7554 2 роки тому

    Nice explanation . Keep the work up

  • @NoamBB1001
    @NoamBB1001 2 роки тому

    ty very much

  • @amirelasaad1554
    @amirelasaad1554 2 роки тому

    In the anonymous class, the compare method returns a value of type int but you return a value of type String(getname()), why isn't that an error?, where does the method compareTo come from it's not implemented anywhere in the classes

  • @rohithkumar1188
    @rohithkumar1188 5 років тому

    Nice explanation
    Presentation was also good

  • @sangamkn6919
    @sangamkn6919 4 роки тому +1

    If Comparator is a interface then how can you create anonymous object/Instance out of it ?

    • @jvsnyc
      @jvsnyc 4 роки тому +1

      Creation of Anonymous Inner Classes was the main way of passing functionality into some other method before Java 8 brought lambdas. There are many tutorials and videos on "Anonymous Inner Classes" as well as using Lambdas to do the same thing more concisely and neatly. He shows what it looks like briefly ~11:30, but there are good places to see both the classical way of using an Anonymous Inner Class and the newer ways of using a lambda in the case of a one off. There are also more sophisticated ways of doing this using method references and comparing in the more modern Java versions.

  • @bhavyashukla9522
    @bhavyashukla9522 3 роки тому

    Very helpful

  • @actuariosonline1647
    @actuariosonline1647 5 років тому

    could you made more videos like this please?

  • @bushari7669
    @bushari7669 7 років тому

    great video, keep it up!

  • @bogadipreethamreddy5114
    @bogadipreethamreddy5114 7 років тому

    nice videos..