Re: Java programming style question
- From: "Daniel Dyer" <"You don't need it">
- Date: Fri, 04 May 2007 15:20:09 +0100
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
.
- Follow-Ups:
- Re: Java programming style question
- From: David Kerber
- Re: Java programming style question
- References:
- Java programming style question
- From: David Kerber
- Java programming style question
- Prev by Date: Java programming style question
- Next by Date: Re: Java programming style question
- Previous by thread: Java programming style question
- Next by thread: Re: Java programming style question
- Index(es):