What are ways to keep hashCode/equals consistent with the business definition of the class?

后端 未结 6 2082
萌比男神i
萌比男神i 2021-02-01 19:12

Object javadocs and Josh Bloch tell us a great deal about how hashCode/equals should be implemented, and good IDEs will handle fields of various types correctly. Some discussio

6条回答
  •  佛祖请我去吃肉
    2021-02-01 20:09

    A potential answer seems to be offered in this question.

    I haven't looked into Project Lombok much, but I immediately thought, hmm annotations would work with a code generator.

提交回复
热议问题