Java 8 中引入的 Comparator.naturalOrder 方法返回一個比較器,該比較器以自然順序比較可比較對象。 對於自然排序,一個類需要實現 Comparable 並定義 compareTo 方法。
確定! 回上一頁