diff --git a/docs/howToUse.md b/docs/howToUse.md index dbf5b68e1fa80d3f99864a9ff3f39de264b71d05..004ad17d73feb074d240601fff60c1fcc1f2a375 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 e28f0c14dd72c99df6d7a9db3b04ad1d97760adf..c9cd0a3a08205f7c86eccf70436c7c685be2ca7c 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