← Exit to Module 11: Collections Framework Deep Dive lessons
Module progress · 0%Lesson · 12 min
Module 11: Collections Framework Deep Dive
Lesson focusComparable vs Comparator
Implement natural ordering or supply external comparators for flexible sorting.
01 · 14 minCollections Hierarchy OverviewLocked02 · 18 minList Implementations: ArrayList, LinkedList, VectorLocked03 · 20 minSet Implementations: HashSet, TreeSet, LinkedHashSetLocked04 · 22 minMap Implementations: HashMap, TreeMap, LinkedHashMapLocked05 · 16 minQueue & Deque ImplementationsLocked06 · 12 minComparable vs ComparatorLocked07 · 12 minCollections Utility ClassLocked08 · 14 minIteration Techniques & Fail-Fast BehaviorLocked09 · 35 minMini-Project: Contact Management SystemLocked
Comparable defines natural ordering inside the class via compareTo.
Comparator objects allow multiple sorting strategies without modifying the class.
Use Comparator factory methods (comparing, thenComparing) for concise definitions.