Possibly a dumb question, but I don\'t want to screw this up. Let\'s say I have two Java classes, Class1 and Class2, where Class2 extends Class1
Class1
Class2
Class2 extends Class1
Although Bozho's suggestion is valid, I prefer this approach:
@Override public int hashCode() { return Objects.hashcode(mField1, getParentField1(), getParentField2()); }