What is the internal sorting technique used in comparator and comparable interfaces and why? [duplicate]

Both Comparable and Comparator are interfaces. All they do is define a way of asking whether one object is greater than, equal to, or less than another. The interfaces don’t enforce what that means — that’s up to the class that implements the interface. So one Comparator<Employee> might say that Adam is “greater than” Bill … Read more