Github user suyanNone commented on the pull request:

    https://github.com/apache/spark/pull/4055#issuecomment-71447811
  
    @srowen, the original `hashCode()` generated by idea auto-generated 
hashcode feature. Now I already refined by your comments.
    About canEqual(), I just according <<programming in Scala>> describe:
    ```
    to Resolve 
    warning: non variable type-argument T in type
    pattern is unchecked since it is eliminated by erasure
    case that: Branch[T] => this.elem == that.elem &&
    ```
    ```
    class Branch[T](
      val elem: T,
      val left: Tree[T],
      val right: Tree[T]
    ) extends Tree[T] {
      override def equals(other: Any) = other match {
        case that: Branch[_] => (that canEqual this) &&
                                              this.elem == that.elem &&
                                              this.left == that.left &&
                                              this.right == that.right
        case _ => false
    }
       def canEqual(other: Any) = other.isInstanceOf[Branch[_]]
       override def hashCode: Int = 41 * (41 * (41 + elem.hashCode) + 
left.hashCode) + right.hashCode
    }
      Listing 30.4 · A parameterized type with equals and
    ```
    
    @cloud-fan , I think `31*hashcode + hashcode`  is more common method to do 
that. 
     
    



---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to