jakarta-jcs-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tore Halset <hal...@pvv.ntnu.no>
Subject Re: CacheElement.hashCode
Date Wed, 01 Oct 2008 21:21:26 GMT
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 <halset@pvv.ntnu.no> wrote:
>
>> From: Tore Halset <halset@pvv.ntnu.no>
>> 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:
>> jcs-users-unsubscribe@jakarta.apache.org
>> For additional commands, e-mail:
>> jcs-users-help@jakarta.apache.org
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: jcs-users-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: jcs-users-help@jakarta.apache.org
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: jcs-users-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jcs-users-help@jakarta.apache.org


Mime
View raw message