Inspectopedia
 
2024.3

'equals()' and 'hashCode()' not paired

Warning
Last modified: 03 December 2024

Reports classes that override equals() but do not override hashCode(), or vice versa. It also reports object declarations that override either equals() or hashCode().

This can lead to undesired behavior when a class is added to a Collection

Example:

The quick-fix overrides equals() or hashCode() for classes and deletes these methods for objects: