public interface Comparable<T> {
    public int compareTo(T o);
}

1. 接口(Comparable:可比较接口)

public static boolean less(Comparable v, Comparable w) {
    return v.compareTo(w) < 0;
}
  • 当然也可以将参数中的 Comparable 具化为 Comparable<Character>
    • public final class Character implements Comparable<Character>
posted on 2018-01-22 23:42  未雨愁眸  阅读(252)  评论(0编辑  收藏  举报