0001 /* 0002 * Comparable对象的默认比较器 0003 */ 0004 0005 package dsa; 0006 0007 public class ComparatorDefault implements Comparator { 0008 public ComparatorDefault() {} 0009 public int compare(Object a, Object b) throws ClassCastException { 0010 return ((Comparable) a).compareTo(b); 0011 } 0012 }