equals与hashCode的区别及联系

1、equals方法用于比较对象的内容是否相等(覆盖以后)

2、hashcode方法只有在集合中用到

3、在集合Set中,只有判断hashcode相等之后并且equals相等才被认为重复数据


转载:https://blog.csdn.net/u010305706/article/details/51105002

猜你喜欢

转载自blog.csdn.net/m0_37738114/article/details/80811113