cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Carsten Ziegeler <cziege...@apache.org>
Subject Re: [CForms] Repeater: why not hashCode for id?
Date Mon, 28 Mar 2005 18:12:52 GMT
Glen Ezkovich wrote:
> On Mar 28, 2005, at 6:35 AM, Carsten Ziegeler wrote:

> 
> I'm sure you are aware of this and take this as you will, the general 
> contract for hashCode states that
> "If two objects are equal according to the equals(Object)  method, then 
> calling the hashCode method on each of the two objects must produce the 
> same integer result."
> 
> So 2 distinct objects may have the same hashCode and it may be 
> necessary to bind 2 equal objects.
> 
Yes, that's true - but I - in the role of the application developer -
know how hashCode works for my own objects. And from the JavaDocs for
Object:
"As much as is reasonably practical, the hashCode method defined by
class Object does return distinct integers for distinct objects."

So unless you have overwritten hashCode everything is fine.

Now, I don't want that the repeater always relies on hashCode but
perhaps as a default - if no identity is given for example. And
everything else stays the same.

Carsten
-- 
Carsten Ziegeler - Open Source Group, S&N AG
http://www.s-und-n.de
http://www.osoco.org/weblogs/rael/

Mime
View raw message