@EqualsAndHashCode(callSuper = false)注解的作用
时间: 2023-08-26 21:18:31 浏览: 116
@EqualsAndHashCode(callSuper = false)注解的作用是排除继承的父类字段进行哈希码和相等性的判断。在使用该注解时,只会比较当前类的字段,不会比较继承的父类的字段。这意味着当两个子类对象的本身字段值相同,即使它们的父类字段值不同,equals方法的返回值也会是true。<span class="em">1</span><span class="em">2</span><span class="em">3</span>
#### 引用[.reference_title]
- *1* [Lombok 中 @EqualsAndHashCode注解的使用](https://blog.csdn.net/Rookie_cc/article/details/118415024)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v92^chatsearchT0_1"}}] [.reference_item style="max-width: 33.333333333333336%"]
- *2* [@EqualsAndHashCode(callSuper = false)作用](https://blog.csdn.net/small_dog_/article/details/121679968)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v92^chatsearchT0_1"}}] [.reference_item style="max-width: 33.333333333333336%"]
- *3* [@EqualsAndHashCode(callSuper = true/false) 作用](https://blog.csdn.net/dj1955/article/details/123822789)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v92^chatsearchT0_1"}}] [.reference_item style="max-width: 33.333333333333336%"]
[ .reference_list ]
阅读全文