The String.intern() call stores the string in a hashtable. It's main advantage is to allow two strings created separately to be compared with ==.
It also saves space, but the expense is the new String's hash has to be recomputed in order to find the matching stored object in the hash. String instances preserve the hash value, but a new String object will need to calculate it once in order to find it's twin in the intern() map. intern() works very well, but make sure you do two things: 1. re-assign the string to the returned value: str = str.intern(); //easy to forget! 2. If you are using '==' as a test, have someone else code review your work to make absolutely sure that every string tested this way is interned. Better yet, assert the .equals() in development and testing: boolean eq = s1 == s2; assert (eq == s1.equals(s2)) : "s1 or s2 not intern()ed!"; -- Matt Bishop The conventional view serves to protect us from the painful job of thinking. --John Kenneth Galbraith ------------------------------------------------------- This SF.Net email sponsored by: Free pre-built ASP.NET sites including Data Reports, E-commerce, Portals, and Forums are available now. Download today and enter to win an XBOX or Visual Studio .NET. http://aspnet.click-url.com/go/psa00100006ave/direct;at.asp_061203_01/01 _______________________________________________ hsqldb-developers mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/hsqldb-developers