From fc60374d613874ba5fd10946c54c3c95471a5b6b Mon Sep 17 00:00:00 2001 From: sjsdfg <736777445@qq.com> Date: Sat, 13 Oct 2018 11:53:08 +0800 Subject: [PATCH] update --- 14.考虑实现Comparable接口.md => 14. 考虑实现Comparable接口.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename 14.考虑实现Comparable接口.md => 14. 考虑实现Comparable接口.md (99%) diff --git a/14.考虑实现Comparable接口.md b/14. 考虑实现Comparable接口.md similarity index 99% rename from 14.考虑实现Comparable接口.md rename to 14. 考虑实现Comparable接口.md index 969ba6c..9934fbb 100644 --- a/14.考虑实现Comparable接口.md +++ b/14. 考虑实现Comparable接口.md @@ -1,4 +1,4 @@ -# 14.考虑实现 Comparable 接口 +# 14. 考虑实现 Comparable 接口 与本章讨论的其他方法不同,`compareTo` 方法并没有在 `Object` 类中声明。 相反,它是 ``Comparable`` 接口中的唯一方法。 它与 Object 类的 equals 方法在性质上是相似的,除了它允许在简单的相等比较之外的顺序比较,它是泛型的。 通过实现 `Comparable` 接口,一个类表明它的实例有一个自然顺序( natural ordering)。 对实现 `Comparable` 接口的对象数组排序非常简单,如下所示: