hashCode in case classes in Scala

前端 未结 4 1355
暗喜
暗喜 2020-12-23 09:25

I\'ve read that Scala\'a case class construct automatically generates a fitting equals and hashCode implementation. What does exactly

4条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2020-12-23 10:10

    Please be aware that the previous answers on this question are a bit outdated on the hashCode part.

    As of scala 2.9 hashCode for case classes uses MurmurHash: link.

    MurmurHash produces good avalanche effect, good distribution and is CPU friendly.

提交回复
热议问题