harmony-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Spark Shen <smallsmallor...@gmail.com>
Subject Re: [optimization] hashCode() evolution
Date Mon, 31 Jul 2006 01:49:27 GMT
Denis Kishenko 写道:
> 2006/7/28, Alexey Petrenko <alexey.a.petrenko@gmail.com>:
>> 2006/7/27, Denis Kishenko <dkishenko@gmail.com>:
>> > Unfortunately
>> > 1. class can has temporary private fields (see BasicStroke.java)
>> We can mark such fields as transient. As for serialization.
>>
>> > 2. class can has final fields which take part in hash code calculation
>> > (see EllipticCurve.java)
>> It's probably the reason to add final fields to hash code calculation.
>
> Yep, we can do this, but as you remember Alex suggested use Eclipse
> tool to make hashCode automatically - it would be easier. But before
> run this tool we have to made a lot of routine work =)
>
Agree. I think using automatic tool is a better way than using 
hashCode.append() diagram for most of the classes.
And if there is specific need, customizing hash code calculation is 
necessary.

Best regards

> Alex's suggestion
> "Lastly, an easier approach is to use a tool (such as Eclipse) to
> generate the implementation of hashCode() automatically based on the
> non-static, non-final variables of a class. This one sounds like (a)
> the easiest, and (b) all-round better performant than any of the
> above."
>
> ---------------------------------------------------------------------
> Terms of use : http://incubator.apache.org/harmony/mailing.html
> To unsubscribe, e-mail: harmony-dev-unsubscribe@incubator.apache.org
> For additional commands, e-mail: harmony-dev-help@incubator.apache.org
>
>


-- 
Spark Shen
China Software Development Lab, IBM



---------------------------------------------------------------------
Terms of use : http://incubator.apache.org/harmony/mailing.html
To unsubscribe, e-mail: harmony-dev-unsubscribe@incubator.apache.org
For additional commands, e-mail: harmony-dev-help@incubator.apache.org


Mime
View raw message