This is the mail archive of the
java@gcc.gnu.org
mailing list for the Java project.
String hashCode
- To: java at gcc dot gnu dot org
- Subject: String hashCode
- From: Bryce McKinlay <bryce at albatross dot co dot nz>
- Date: Thu, 01 Feb 2001 12:25:19 +1300
Is there a reason not to keep a hashcode field in String objects,
instead of recalculating it every time String.hashCode() is called?
This would speed up String.equals() by being able to return false
quickly in the common case, as well as speeding up things like
Hashtables of Strings and string interning.
regards
[ bryce ]