From 1a1ebed0cd11a4405add377d6c9519fe90050795 Mon Sep 17 00:00:00 2001 From: Hongkuan Wang Date: Mon, 14 Sep 2020 20:46:28 +0300 Subject: [PATCH] Fix typo --- docs/book/Appendix-Understanding-equals-and-hashCode.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/docs/book/Appendix-Understanding-equals-and-hashCode.md b/docs/book/Appendix-Understanding-equals-and-hashCode.md index 9cfeb1d5..01889642 100644 --- a/docs/book/Appendix-Understanding-equals-and-hashCode.md +++ b/docs/book/Appendix-Understanding-equals-and-hashCode.md @@ -69,7 +69,8 @@ import java.util.*; public class Equality { protected int i; protected String s; - protected double d;public Equality(int i, String s, double d) { + protected double d; + public Equality(int i, String s, double d) { this.i = i; this.s = s; this.d = d; @@ -141,7 +142,7 @@ Expected false, got false **testAll()** 执行了我们期望的所有不同类型对象的比较。它使用工厂创建了**Equality**对象。 -在 **main()** 里,请注意对 **testAll()** 的调用很简单。因为**EqualityFactory**有着单一的函数,它能够和lambda表达式一起使用来表示**make()**函数。 +在 **main()** 里,请注意对 **testAll()** 的调用很简单。因为**EqualityFactory**有着单一的函数,它能够和lambda表达式一起使用来表示 **make()** 函数。 上述的 **equals()** 函数非常繁琐,并且我们能够将其简化成规范的形式,请注意: 1. **instanceof**检查减少了**null**检查的需要。