Re: Java programming style question



On Fri, 04 May 2007 15:00:35 +0100, David Kerber <ns_dkerber@xxxxxxxxxxxxxxxxxxxxxxxxxxxxx> wrote:

What is the preferred way of checking for an empty string that I already
know is not Null?

Is it better (however you define that) to check for .length = 0, or
.equals( "" )?


I don't think it really matters, as long as you don't use ==. IntelliJ IDEA suggests using .length() for performance reasons, but I doubt it would make any noticeable difference in most cases.

Dan.

--
Daniel Dyer
http://www.uncommons.org
.