Closed gmelon closed 1 year ago
p.69 에 파생 필드는 hashcode 계산에서 제외해도 되는 이유 가 어차피 이미 다른 필드를 통해 hashcode가 계산될 것이기 때문에 파생 필드를 통해 hashcode를 업데이트한다고 해도 두 인스턴스간에 만들어질 hashcode는 변화가 없을 것이기 때문일까요??
파생 필드는 hashcode 계산에서 제외해도 되는 이유
int 원래필드 = 10; int 파생필드 = 원래필드 / 10;
hashcode() { 원래필드 + 파생필드 }
hashcode() { 원래필드 }
p.69 에
파생 필드는 hashcode 계산에서 제외해도 되는 이유
가 어차피 이미 다른 필드를 통해 hashcode가 계산될 것이기 때문에 파생 필드를 통해 hashcode를 업데이트한다고 해도 두 인스턴스간에 만들어질 hashcode는 변화가 없을 것이기 때문일까요??