#95 Comparator vs Comparable in Java
Unlock all features
FREE: Get instant access to 10 AI summaries, chats, or transcripts per day.
Unlock all features
FREE: Get instant access to 10 AI summaries, chats, or transcripts per day.
Unlock all features
FREE: Get instant access to 10 AI summaries, chats, or transcripts per day.
Unlock all features
FREE: Get instant access to 10 AI summaries, chats, or transcripts per day.
Unlock all features
FREE: Get instant access to 10 AI summaries, chats, or transcripts per day.
Related videos
Java 25 is here
Telusko
61.2k views
Docker for Java Developers
Telusko
114.1k views
Java For Programmers in 2 hours
Telusko
180.9k views
Tree Implementation in Java | DSA
Telusko
108.7k views
Java Database Connectivity | JDBC
Telusko
617.2k views
Java Marathon | Live for 7 hours
Telusko
51.9k views
Java Interview Questions | Macbook Contest
Telusko
46.2k views
#94 Map in Java
Telusko
169.2k views
#92 ArrayList in Java
Telusko
221.8k views
#89 Race Condition in Java
Telusko
142.1k views
Top Comments (10)
So glad you're updating your older videos. Helpful as always! 😁
Logic to sort elements based on the length of the string import java.util.Comparator; import java.util.*; class Solution { public static void main(String[] args) { Comparator<String> com = new Comparator<>(){ public int compare(String a , String b){ if(a.length() > b.length()) return 1; else return -1; } }; List<String> nums = new ArrayList<>(); nums.add("Python"); nums.add("C++"); nums.add("Java"); nums.add("Django"); nums.add("SpringBoot"); nums.add("Spring"); Collections.sort(nums , com); System.out.println(nums); } }
The last 2 mins are very insightful!! 😍😍
Good video. Thanks for leaving in the errors so we can learn.
I must say this was one of the best videos explaining comparator and comparable concept.
You literally teach and explain everything about sorting with object in 15 mins that my professor wasn't able to do in 2 hours. Good job and keep doing these things because it's really helpful and valuable to a fresher like me <3
Navin sir.... Really fond of u..... I sat for 5 hrs to understand it.... Now im crystal clear
best java instructor i’ve ever come across
Reddy ji! No words Thanks for your explanation
You are truly amazing! I have never met anyone like you. Your teaching is outstanding—amazing, effective, and excellent. I have gained deep knowledge of OOPs in Java, and it's all because of your course. Thanks to this, I cracked my aptitude test and interview today! I just want to say a special thank you to you. Because of your deep knowledge, we gain deep knowledge too. Thank you!
Unlock the Data Inside
Turn Videos into Knowledge
- Get FREE 10/day: transcripts, summaries, chats
- Chat with videos, export text & PDF
- $1 free API credit for RAG, chatbots & research
Free forever plan • All features unlocked
Top Comments (10)
So glad you're updating your older videos. Helpful as always! 😁
Logic to sort elements based on the length of the string import java.util.Comparator; import java.util.*; class Solution { public static void main(String[] args) { Comparator<String> com = new Comparator<>(){ public int compare(String a , String b){ if(a.length() > b.length()) return 1; else return -1; } }; List<String> nums = new ArrayList<>(); nums.add("Python"); nums.add("C++"); nums.add("Java"); nums.add("Django"); nums.add("SpringBoot"); nums.add("Spring"); Collections.sort(nums , com); System.out.println(nums); } }
The last 2 mins are very insightful!! 😍😍
Good video. Thanks for leaving in the errors so we can learn.
I must say this was one of the best videos explaining comparator and comparable concept.
You literally teach and explain everything about sorting with object in 15 mins that my professor wasn't able to do in 2 hours. Good job and keep doing these things because it's really helpful and valuable to a fresher like me <3
Navin sir.... Really fond of u..... I sat for 5 hrs to understand it.... Now im crystal clear
best java instructor i’ve ever come across
Reddy ji! No words Thanks for your explanation
You are truly amazing! I have never met anyone like you. Your teaching is outstanding—amazing, effective, and excellent. I have gained deep knowledge of OOPs in Java, and it's all because of your course. Thanks to this, I cracked my aptitude test and interview today! I just want to say a special thank you to you. Because of your deep knowledge, we gain deep knowledge too. Thank you!