You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucene.apache.org by David Spencer <da...@tropo.com> on 2004/08/31 21:02:33 UTC

Obscure point about Term.hashCode()

Just stumbled across this when running Optimizeit over an app that uses 
Lucene. Isn't the XOR operator more normally used in hashCode() as it 
mixes and distributes the bits more, or is the reasoning that the hash 
code of strings are already mixed decently enough? I don't even know if 
this routine is being called -just a source code inspection question.

This is the code:

	public final int hashCode() {
		return field.hashCode() + text.hashCode();
	}

And my suggestion means changing the "+" to a "^".

-- Dave


---------------------------------------------------------------------
To unsubscribe, e-mail: lucene-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: lucene-dev-help@jakarta.apache.org