为何equals和hashcode必定要一块儿重写?

这是规则 不是结论

 

两个对象相等,hashcode必定相等spa

两个对象不等,hashcode不必定不等code

 

hashcode相等,两个对象不必定相等对象

hashcode不等,两个对象必定不等hash

相关文章
相关标签/搜索