EHC.EQ

The EHC Class should implement both equals(Object) and hashCode() methods. EHC warnings appear if an equals() method was specified without a hashCode() method, or vice versa. This warning appears if a hashCode() is specified without an equals(). This may cause a problem with some collections that expect equal objects to have equal hashcodes.

Example 1

8  public class EHC_EQ_Sample_1 {
9      private int seed;
10     public EHC_EQ_Sample_1(int seed) {
11         this.seed = seed;
12     }
13     public int hashCode() {
14         return seed;
15     }
16     // no equals(Object o) method defined
17 }

EHC.EQ is reported for class declaration on line 8: Class defines hashCode() but does not define equals().

Related checkers