Naming a method tostring
, hashcode()
or equal
is either:
toString
, Object.hashCode()
(note the camelCasing) or
Object.equals
(note the 's' on the end) was meant, and the application does not behave as expected. In both cases, the method should be renamed.
public int hashcode() { /* ... */ } // Noncompliant public String tostring() { /* ... */ } // Noncompliant public boolean equal(Object obj) { /* ... */ } // Noncompliant
@Override public int hashCode() { /* ... */ } @Override public String toString() { /* ... */ } @Override public boolean equals(Object obj) { /* ... */ }