Comparable和Comparator都是接口.
Comparable: 内比较器,类设计时,实现compareTo(Object o)方法,return this - o升序,return o - this降序。
Comparator:外比较器,类设计完成时,实现compare(T t1, T t2)方法 return t1 - t2 升序,return t2 - t1降序。通常通过匿名内部类来完成比较。
外比较器更加灵活,若同一对象有不同的比较规则,通过增加外比较器实现而不会影响其他的比较规则;对于内比较器,只能修改compareTo方法的实现,这可能会影响之前的比较规则。