[jdom-interest] getText

Brett McLaughlin brett.mclaughlin at lutris.com
Wed Oct 4 09:09:45 PDT 2000


OK. Executive decision. 

getText() no longer returns null, it returns the empty String, when
there is either no content or empty content, etc.

The only negative I heard was that comparison to null was less costly
than comparison to "" with .equals(). This is true; however, I think the
typical code ends up being this anyway:

String text = element.getText();
if ((text != null) && (!text.equals("")) {
  System.out.println("Element text is " + text);
}

in which case you use both. So you actually save this way.

So I'm putting it in CVS now.

-Brett

-- 
Brett McLaughlin, Enhydra Strategist
Lutris Technologies, Inc. 
1200 Pacific Avenue, Suite 300 
Santa Cruz, CA 95060 USA 
http://www.lutris.com
http://www.enhydra.org



More information about the jdom-interest mailing list