I need to sort on a list of objects so, I wrote a new class that implements Comparator and it works. Then something popped into my head and I started to wonder if I had used Comparable instead of creating the new class to implement a Comparator.
Can anyone give me a clear idea on when to use comparable and comparator?