> -----Original Message-----
> From: Andreas Schaefer [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, August 10, 2000 7:45 AM
> To: jBoss Developer
> Subject: Re: [jBoss-Dev] [newbie] byte[].hashcode()
>
>
> Hi
>
> According to the spec the .hashCode() has to return the same
> value if they
> are
> equal.
But notice that does not imply the reverse. Two items that are not equal
could
have the same hasCode. So if the byte arrays are large why set the
iteration to
some fraction of size?
init iterationSize = bytes.lenght/7
> for( int i = 0; i < bytes.length(); i+=iterationSize ) {
> lsCode += "" + bytes[ i ];
> }
I just picked 7, obviously the biger the iterationSize the more false hit's
in a hash table,
the lower the iterationsize the more time to compute the hashCode.
I'd write some test code with 'typical data' to adjust the number and see if
there was any major diffs in performance. Notice I said I would (I head to
the Canadian Maritimes for vacation in less than 48 hours ;)
Just a random thought.
-Peace
Dave