harmony-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Krzysztof Sobolewski <jez...@interia.pl>
Subject Re: [optimization] Algorithmic tricks
Date Wed, 26 Jul 2006 18:57:50 GMT
Denis Kishenko wrote:

<lurker-mode-off>
> Example of using
> 
> 
>     public int hashCode() {
>        HashCode hash = new HashCode();
>        hash.append(m00);
>        hash.append(m01);
>        hash.append(m02);
>        hash.append(m10);
>        hash.append(m11);
>        hash.append(m12);
>        return hash.hashCode();
>    }
> (...)
> Any comments?

How about
return Arrays.hashCode(new Object[] {x, y, name});
?
Short, concise, a bit allocation-heavy (esp. for primitives (boxing)), but
for non-critical hashes should be fine.
</lurker-mode-off>
-KS


Mime
View raw message