EHC.HASHThe 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 may cause a problem with some collections that expect equal objects to have equal hashcodes. Example 18 public class EHC_HASH_Sample_1 { 9 private int seed; 10 public EHC_HASH_Sample_1(int seed) { 11 this.seed = seed; 12 } 13 public boolean equals(Object o) { 14 return (o instanceof EHC_HASH_Sample_1) 15 && ((EHC_HASH_Sample_1) o).seed == seed; 16 } 17 // no hashCode method defined 18 } EHC.HASH is reported for class declaration on line 8: Class defines equals() but does not define hashCode(). Security guidelinesRelated checkers |