View Categories

Override Both Equals And Hashcode

Table of Contents

Impact area

Manageability

Severity

Medium

Affected element

Apex Class

Rule ID #

SF-OVERRIDE-BOTH

Impact #

Override equals() and not override hashCode() can result in unexpected behavior when your class is in conjunction with all hash-based collections.

Remediation

You must override hashCode() in every class that overrides equals().

Time to fix

30 min

References #

This rule is linked to OverrideBothEqualsAndHashcode

Powered by BetterDocs