During one of my interview, I was asked
What is the performance difference between Comparable and Comparator?
I replied that I don't know. The interviewer said,
If Comparable is implemented by a class Employee, when 5000 Employee objects are created and added in an ArrayList, there will be 5000 objects with compareTo methods in heap memory. So unless absolutely necessary, don't use Comparable. With Comparator, the above mentioned memory overhead is eliminated.
Was he correct in saying that?