What are the Differences Between Comparable and Comparator in Java ?
Main differences between Comparable and Comparator are...
Type - Comparable
Comparator
Sorting - In Comparable, we can only create one sort sequence. In Comparator we can create multiple sort sequences.
Method Used - Comparator
Objects for Comparison - The Comparator compares two objects given to it as input. Comparable interface compares "this" reference with the object given as input.
Package location - Comparable interface in Java is defined in java.lang package. Comparator interface in Java is defined in java.util package.