/** * how to defeat generics and compare the way you did before generics were invented. */ public class UniversalComparator implements Comparator<Comparable <?>> { public int compare(Comparable<?> o1, Comparable<?> o2) { return ((Comparable<Object>) o1).compareTo(o2); } }