Did I implement equals and hashCode correctly using Google Guava?

前端 未结 3 2186
长发绾君心
长发绾君心 2021-02-20 17:18

I am using hibernate and need to override equals and hashCode(). I chose to use google-guava\'s equals and hashCode helpers.

I wanted to know if I am missing something

3条回答
  •  深忆病人
    2021-02-20 17:42

    Its fine as is. Although instanceof makes the null check unnessary.

    Also, I think its fine to use auto generated id's, although this is very debatable.

提交回复
热议问题