bug report in String.hashCode()

Per Bothner bothner at cygnus.com
Wed Aug 5 13:10:00 PDT 1998


> +	boolean hashIsValid;
> +	int hash;
> ...
> +	if (!hashIsValid) {
> ...
> +		hashIsValid = true;

To safe one word in each String, I would suggest:

	if (hash == 0 && count > 0)
		...

Very unlikely that you will need to calculate the hash more than once.

	--Per Bothner
Cygnus Solutions     bothner at cygnus.com     http://www.cygnus.com/~bothner



More information about the kaffe mailing list