// Textbook fragment 08.07 /** Comparator based on the natural ordering */ public class DefaultComparator implements Comparator { /** Compares two given elements */ public int compare(E a, E b) throws ClassCastException { return ((Comparable) a).compareTo(b); } }