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

Last modified: 03 December 2024

Reports classes that override the equals() method but do not override the hashCode() method or vice versa, which can potentially lead to problems when the class is added to a Collection or a HashMap.

The quick-fix generates the default implementation for an absent method.

Example:

After the quick-fix is applied: