O
Oz Levanon
Hi, I'm implementing a hashCode method for a class that holds (among
other members) a byte array (byte []).
Currently, to get the hashCode of the byte[], I'm using:
int hashCode = new String(data).hashCode();
Since this class will be used many times in a Hashtable, I wanted to
know if that's an efficient way to get the hashCode, since the
creation of a new String must be time consuming.
The other methods I know of that return a number representing the
array (Adler32, MD5, CRC32) are even slower.
Is there a faster way to get the hashCode for an array of primitives?
TIA, Oz.
other members) a byte array (byte []).
Currently, to get the hashCode of the byte[], I'm using:
int hashCode = new String(data).hashCode();
Since this class will be used many times in a Hashtable, I wanted to
know if that's an efficient way to get the hashCode, since the
creation of a new String must be time consuming.
The other methods I know of that return a number representing the
array (Adler32, MD5, CRC32) are even slower.
Is there a faster way to get the hashCode for an array of primitives?
TIA, Oz.