Java之所有物件的公用方法>8.Obey the general contract when overriding equals

FrankYou發表於2017-05-31

Overriding the equals method seems simple, but there are many ways to get it wrong, and consequences can be dire.

The easiest way to avoid problems is not to override the equals method, in which case each instance of the class is equal only to itself. 

相關文章