14.8 Collection and Generics Part 5 in Java with Comparable Interface

preview_player
Показать описание
In comparator interface we have compare() and comparable compareTo(). If you are going with

custom class then it its preferable to go with comparable interface. And if it is in-build class then

we can use comparator.

Follow on Facebook:

Subscribe to our other channel:
Telusko Hindi :

Subscribe to the channel and learn Programming in easy way.

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

please fix the audio. apart from that, great great channel

grrlgd
Автор

That's one perfect explanation..Thanks !!

dnyaneshtathode
Автор

Thanks sir ..i have understand...all the things

AnkitKumar-xpiv
Автор

Just to add a few words. If we think of Comparable as appropriate when there is one natural, obvious way to sort/compare two elements, but Comparator as Custom Comparator, you still very well may wish to write Comparator implementations even if the class has a "default" natural sorting order. Of course, if you can't control the class in question, as you mention, you really have no choice.

jvsnyc
Автор

Sir please do a complete series on java collections

thisisbhum
Автор

Where did you called the compareTo method??? Can you please explain how that method is being called after caling the sort method

BalrajSingh-jbul
Автор

When I was mentions class student implements Comparable<student>.... Is showing me error as The type student is already defined....
What should I do here sir...?
Waiting for u reply

jagadeeswaris
Автор

The content is good but the voice quality is not that good on 14.7 and 14.8 tutorials. Please redo them with better voice quality.

michaelgathogo
Автор

Request sir....audio sound is not proper. Rest is fantastic :)

pravinandhale
Автор

Sir can u plz keep event handling videos

anandvarmauppalapati
Автор

how does it work whenever i call the sort method ??

khairahammed
Автор

14.7 and 14.8 are not good, seems like different person explained the concepts which is not good.

periyasamynainar
Автор

What is this.marks and s.marks.. What values are they representing??

jatinlalwani
Автор

I didn't understand when to go for comparable and when to go for comparator.

lokeshdohare