Can someone help me understand the following concepts from Java Collection API?
- How does
Collection.sort()
work in Java? - What roles do
Comparable
andComparator
play in sorting? - How can I implement
Collection.sort()
in my program?
I am having tough time understanding above concepts. Please help me in understanding these concepts.If possible give examples.