This is the basic implementation for a class that is directly derived from java.lang.Object:
public boolean equals(final Object object) {This is the basic implementation for a class that is NOT directly derived from java.lang.Object:
if (this == object) {
return true;
}
if (object == null) {
return false;
}
if (getClass() != object.getClass()) {
return false;
}
// TODO compare all fields of this class
return true;
}
public boolean equals(final Object object) {
if (this == object) {
return true;
}
if (!super.equals(object)) {
return false;
}
// TODO compare all fields of this class
return true;
}