See my comments below:

Denis Kishenko 写道:
Example of using


public int hashCode() {
HashCode hash = new HashCode();
hash.append(m00);
hash.append(m01);
hash.append(m02);
hash.append(m10);
hash.append(m11);
hash.append(m12);
return hash.hashCode();
}

public int hashCode() {
HashCode hash = new HashCode();
hash.append(width);
hash.append(cap);
hash.append(join);
hash.append(miterLimit);
if (dash != null) {
hash.append(dashPhase);
for(int i = 0; i < dash.length; i++) {
hash.append(dash[i]);
}
}
return hash.hashCode();
}

IIRC, this style of code is very similar with those from apache common project. :-)

I do have a concern that in some classes, hash calculation does have very import impact, but in some others may not be so important, or may not be taken so heavy use. IMHO, the 'degree of hashing' provided by this method may be a little too general to use by all classes. It may be too heave
for some, but too light for others.

But only several classes are using it. I suggest integrate HashCode in
all hashCode() implementations (about 200 files), I can do this. Anybody
else can improve HashCode work.

Such a utility class is very helpful, but utilize it in all classes may not be suitable. And do have some 'premature optimization' smell here. As anthon said

"What I'm talking about is not related to 'premature optimization' that
is now being discussed in another thread but something very narrow,
limited to maybe one method and not influencing anything else. "


Best regards



Any comments?



--
Spark Shen
China Software Development Lab, IBM



---------------------------------------------------------------------
Terms of use : http://incubator.apache.org/harmony/mailing.html
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to