From d2e8ff3bf94cfe72953b51ceb99ef6893aaa9ea3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=A2=A6=E5=A2=83=E8=BF=B7=E7=A6=BB?= Date: Mon, 19 Jul 2021 22:39:34 +0800 Subject: [PATCH] change readme --- docs/howToUse.md | 4 ++-- docs/howToUse_en.md | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/howToUse.md b/docs/howToUse.md index dbf5b68..004ad17 100644 --- a/docs/howToUse.md +++ b/docs/howToUse.md @@ -222,8 +222,8 @@ def (int: Int, j: Int, k: Option[String], t: Option[Long], b: Int) = { - 说明 - `verbose` 指定是否开启详细编译日志。可选,默认`false`。 - `excludeFields` 指定是否需要排除不需要用于`equals`和`hashCode`方法的字段。可选,默认空(class内部所有非私有的`var、val`字段都将被应用于生成这两个方法)。 - - `equals`和`hashCode`方法均会被超类的影响,`canEqual`使用`isInstanceOf`。 - - 采用简单hashCode算法,父类的hashCode是直接被累加的。 + - `equals`和`hashCode`方法均会被超类影响,`canEqual`使用`isInstanceOf`,有些人在实现时,使用的是`this.getClass == that.getClass`。 + - 采用简单hashCode算法,父类的hashCode是直接被累加的。该算法是`case class`使用的。 - 示例 diff --git a/docs/howToUse_en.md b/docs/howToUse_en.md index e28f0c1..c9cd0a3 100644 --- a/docs/howToUse_en.md +++ b/docs/howToUse_en.md @@ -229,7 +229,7 @@ The `@equalsAndHashCode` annotation is used to generate `equals` and `hashCode` default is `Nil` (all non private `var` and `val` fields in the class will be used to generate the two methods). - Both `equals` and `hashCode` methods are affected by super classes, and `canEqual` uses `isInstanceOf` in `equals` method. Some equals implementations use `that.getClass == this.getClass` - - It uses simple hashcode algorithm, and the hashcodes of the parent class are accumulated directly. + - It uses simple hashcode algorithm, and the hashcodes of the parent class are accumulated directly. The algorithm is also used by `case class`. - Example -- GitLab