[jdom-interest] Re: [jdom-commits] CVS update: jdom/src/java/org/jdom/input

Noam Tamim noamt at yahoo.com
Sat Mar 2 04:13:36 PST 2002

--- cvs at jools.org wrote:
> Changed some string comparators from != to !.equals().  The former works
> so long as the parser interns strings, and although Xerces and Crimson do,
> not all parsers do.  So using !.equals() is safer.  Brad Huffman ran some
> tests to see if this had much of a performance impact, and surprisingly
> it didn't and in fact sometimes ran *faster*.  Below is his table, for 
> future reference.

Of-course it doesn't have much of a performance impact. Look at
the first three lines of String.equals() :

if (this == anObject) {
    return true;

So, asking 
   if (str1.equals(str2)) 
is just like asking 
   if (str1==str2 || str1.equals(str2))


Do You Yahoo!?
Yahoo! Sports - sign up for Fantasy Baseball

More information about the jdom-interest mailing list