Comparable and Comparator are Java interfaces that help us write "generic" sorting methods. interface Comparable { public int compareTo(T that); } interface Comparator { public int compare(T first, T second); } An implementation of a sorting method is "generic" if it can sort more than just one kind of list (or array). For example, a non-generic sorting method might be declared like this, public static void sortStrings(List list) Another non-generic sorting method might be declared like this, public static void sortIntegers(List list) The first method can only sort lists of strings while the second method can only sort lists of integers. The definitions of the two methods probably look almost exactly alike, with just a few mentions of "String" replaced by mentions of "Integer". We do not want to have to write multiple versions of sorting methods (like an additional sortDouble). We would like to write a single sorting method and then reuse if for many different types of lists. This is what we mean by a "generic" sorting method. Comparable and Comparator are tools that Java gives us to make it possible to write such generic methods. We have two interfaces, Comparable and Comparator, because there are two ways to write a generic sorting method. One way to write a generic sorting method is for the sort method to assume that the objects it is sorting know how to compare themselves to other objects of the same type. In other words, the sort method expects the objects that it is sorting to implement the Comparable interface. This is how say this in Java. public static > void sort(List list) Notice how sort takes a list of T objects, but the type T has to satisfy the condition that it implements the Comparable interface. The other way to write a generic sorting method is for the sorting method to not make any assumption about the type of objects being sorted but instead to assume that the sorting method has a "helper" method that knows how to compare any two of the objects being sorted. The "helper" method needs to be contained in some object, so the sort method expects a second parameter which is an object that holds the helper compare() method. An object that holds a compare() method is an object that implements the Comparator interface. If the sorting method is sorting objects of type T, then the helper method needs to be able to compare two T objects. Here is how we declare this kind of generic sorting method. public static void sort(List list, Comparator cmp) There is no condition on the type T, but there does need to exist an object that holds a compare method that knows how to compare two T objects. Notice how in both kinds of generic sorting methods the sorting method needs a helper method that does the actual comparing of two objects. In the first case, the sort method assumes that each T object contains its own comparing method (the T class implements the Comparable interface). In the second case, the sorting method explicitly requires a second parameter that must hold the comparing method (the second parameter implements the Comparator interface). In each case, Java uses an interface as the way to enforce the existence of the needed comparing helper method. Of the two ways to write a generic sorting method, the second way is more versatile and more interesting. The Comparator parameter to the sorting method changes the behavior of the sorting method. The sorting method has "parameterized behavior", which is an important concept in programming.