On Apr 11, 2005, at 5:57 PM, Yonik Seeley wrote:
Erik, why was the last change to BooleanQuery made? The comment was "Correct BooleanQuery.equals such that every clause is compared".
It looks like Vector.equals() should have worked, and the new code is probably slower as it creates two new arrays.
Vector.equals() compares the Vector object instances and is only true if they are the same object - it does not compare the contents of the Vector for equality at that level. Try it out with some test cases.
Where in the .equals that I added are two arrays being created?
public boolean equals(Object o) {
if (!(o instanceof BooleanQuery))
return false;
BooleanQuery other = (BooleanQuery)o;
return (this.getBoost() == other.getBoost())
&& Arrays.equals(this.getClauses(), other.getClauses());
}It's especially risky on this list to use the word "probably" when talking about speed. :) Is it really slower?
I'm more than happy to adjust the .equals method to something better; do you have a specific improvement?
Erik
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
