Java Sorting with Generics: Comparable vs Comparator
Learn how to sort in Java using Generics, Comparable, and Comparator with easy-to-understand explanations and examples. ⚙️

Selenium Express
2.1K views • May 20, 2025

About this video
In this video, we dive deep into the Java Collections.sort() method and break down the often confusing generic syntax:
T extends Comparable ? super T
What you'll learn:
What the generic syntax means
Why Java uses T extends Comparable ? super T instead of just T
How Comparable plays a role in sorting
sort(ListT list, Comparator ? super T c
Comparator and it's role in sorting
Practical examples for better understanding
Generics + Collections together
Whether you're a Java beginner or brushing up on advanced generics, this video will help you understand the logic behind Java's sorting mechanism.
Tip: Stick around till the end for bonus tips on using Collections.sort() with custom objects!
Timestamp
------------------
00:00 – Intro
03:00 – Java Generics Inheritance hands on (extends & super)
20:38 – Java sort() generics syntax explained
25:46 – Sorting Custom Objects with Comparable
35:22 - Why Comparable ? super T
45:58– Sort with Comparator : decoding generic design
Don’t forget to like comment, and subscribe for more Java tutorials and coding insights!
#java #collectionframework #sorting #generics #javatutorial #comparator
For More free/paid courses visit
www.seleniumexpress.com
LINKS AND FREE LEARNING RESOURCES
========
Watch my new mock interview series for java developers
https://youtu.be/yX2w-Sof95s
Watch Spring boot Hot topics
https://youtu.be/CUQWZHjuq-w
Java Interview / Question and Answer series
https://youtu.be/Y1uGGTrBYKw
Explain spring Bean Lifecycle
https://youtu.be/hUYGGqoXEPc
spring core
https://www.youtube.com/watch?v=r2Q0Jzl2qMQ&list=PL3NrzZBjk6m-nYX072dSaGfyCJ59Q5TEi
spring mvc
https://www.youtube.com/watch?v=zCHrZdJODg4&list=PL3NrzZBjk6m-OSeL3DRMD_ISa0u-9c1l1
spring mvc intermediate
https://www.youtube.com/watch?v=40YaLHbrwrY&list=PL3NrzZBjk6m_2jw8sC0BkEwSPFHxgQDWr
Spring JDBC
https://www.youtube.com/watch?v=5j_vh1b9dV8&list=PL3NrzZBjk6m-rYTKze-5Y5RvU8eykal4j
spring live project
https://www.youtube.com/watch?v=m_b_FwDjAXM&list=PL3NrzZBjk6m-9CVPueDLLermojwtfuW_f
SPRING SECURITY COURSE[NEW]
https://youtu.be/NMNLozLGT1s
For more courses visit
https://www.seleniumexpress.com
Any time you are getting stuck with issues, Feel free to ask for support.
You can send mail to seleniumexpress@gmail.com
you can ping me on my Facebook page
https://www.facebook.com/seleniumexpress
Make sure to join my private Facebook page (Ask me here)
“SeleniumExpress - Support"
https://www.facebook.com/groups/187000222361579/
you can ask for support in my website forum
https://www.seleniumexpress.com
Subscribe to my youtube channel
Follow me on Insta
https://www.instagram.com/selenium_express/
T extends Comparable ? super T
What you'll learn:
What the generic syntax means
Why Java uses T extends Comparable ? super T instead of just T
How Comparable plays a role in sorting
sort(ListT list, Comparator ? super T c
Comparator and it's role in sorting
Practical examples for better understanding
Generics + Collections together
Whether you're a Java beginner or brushing up on advanced generics, this video will help you understand the logic behind Java's sorting mechanism.
Tip: Stick around till the end for bonus tips on using Collections.sort() with custom objects!
Timestamp
------------------
00:00 – Intro
03:00 – Java Generics Inheritance hands on (extends & super)
20:38 – Java sort() generics syntax explained
25:46 – Sorting Custom Objects with Comparable
35:22 - Why Comparable ? super T
45:58– Sort with Comparator : decoding generic design
Don’t forget to like comment, and subscribe for more Java tutorials and coding insights!
#java #collectionframework #sorting #generics #javatutorial #comparator
For More free/paid courses visit
www.seleniumexpress.com
LINKS AND FREE LEARNING RESOURCES
========
Watch my new mock interview series for java developers
https://youtu.be/yX2w-Sof95s
Watch Spring boot Hot topics
https://youtu.be/CUQWZHjuq-w
Java Interview / Question and Answer series
https://youtu.be/Y1uGGTrBYKw
Explain spring Bean Lifecycle
https://youtu.be/hUYGGqoXEPc
spring core
https://www.youtube.com/watch?v=r2Q0Jzl2qMQ&list=PL3NrzZBjk6m-nYX072dSaGfyCJ59Q5TEi
spring mvc
https://www.youtube.com/watch?v=zCHrZdJODg4&list=PL3NrzZBjk6m-OSeL3DRMD_ISa0u-9c1l1
spring mvc intermediate
https://www.youtube.com/watch?v=40YaLHbrwrY&list=PL3NrzZBjk6m_2jw8sC0BkEwSPFHxgQDWr
Spring JDBC
https://www.youtube.com/watch?v=5j_vh1b9dV8&list=PL3NrzZBjk6m-rYTKze-5Y5RvU8eykal4j
spring live project
https://www.youtube.com/watch?v=m_b_FwDjAXM&list=PL3NrzZBjk6m-9CVPueDLLermojwtfuW_f
SPRING SECURITY COURSE[NEW]
https://youtu.be/NMNLozLGT1s
For more courses visit
https://www.seleniumexpress.com
Any time you are getting stuck with issues, Feel free to ask for support.
You can send mail to seleniumexpress@gmail.com
you can ping me on my Facebook page
https://www.facebook.com/seleniumexpress
Make sure to join my private Facebook page (Ask me here)
“SeleniumExpress - Support"
https://www.facebook.com/groups/187000222361579/
you can ask for support in my website forum
https://www.seleniumexpress.com
Subscribe to my youtube channel
Follow me on Insta
https://www.instagram.com/selenium_express/
Tags and Topics
Browse our collection to discover more content in these categories.
Video Information
Views
2.1K
Likes
91
Duration
01:04:15
Published
May 20, 2025
User Reviews
4.5
(2) Related Trending Topics
LIVE TRENDSRelated trending topics. Click any trend to explore more videos.
No specific trending topics match this video yet.
Explore All Trends