Hello.

Sorry, I mis-remembered a sentence from effective java. I usually implement both hashCode and equals if I want to implement one of them, but the rule is to "Always override hashCode when you override equals".

Source:
http://java.sun.com/developer/Books/effectivejava/Chapter3.pdf

Regards,
 - Tore.

On 1. okt.. 2008, at 18.57, Aaron Smuts wrote:

sorry, sent that accidentally.   . . .

But two unequal objects can return the same hashcode. There is no problem with that. The hashcode will return the same for equal objects. That's all that it needs to do to obey the contract.

Aaron


--- On Tue, 9/30/08, Tore Halset <[EMAIL PROTECTED]> wrote:

From: Tore Halset <[EMAIL PROTECTED]>
Subject: CacheElement.hashCode
To: "JCS Users List" <jcs-users@jakarta.apache.org>
Date: Tuesday, September 30, 2008, 11:33 PM
Hello.

I see that CacheElement implements hashCode, but not
equals. Why break
this fundamental rule?

 - Tore.

---------------------------------------------------------------------
To unsubscribe, e-mail:
[EMAIL PROTECTED]
For additional commands, e-mail:
[EMAIL PROTECTED]

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to