That's a good question, and one to which I do not know the answer. My HUNCH is that, as you say, modern compilers would deal with that easy enough. I could be very wrong though.

Anyone happen to know for sure?


From: Robert Bateman <[EMAIL PROTECTED]>
Reply-To: "Tomcat Users List" <[EMAIL PROTECTED]>
To: "Tomcat Users List" <[EMAIL PROTECTED]>
Subject: Re: how to check if a String is empty?
Date: Fri, 18 Jun 2004 13:21:09 -0400

Frank,

NOT questioning your "solution", but doesn't the call to equalsIgnoreCase("")
cause a temp String object to be created and destroyed? Or do todays JIT
compilers handle that case effectively?


Bob

On Thursday 24 June 2004 01:16 pm, Frank Zammetti wrote:
> I've always done
>
> if (test == null || test.trim().equalsIgnoreCase("")) { }
>
> (I'm anal about always using equalsIgnoreCase unless I know for sure that
> case sensitivity is required). No need to do anything more complex than
> that in my experience. "Always do the simplest thing that will work".
>
> Frank



--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]


_________________________________________________________________
MSN Movies - Trailers, showtimes, DVD's, and the latest news from Hollywood! http://movies.msn.click-url.com/go/onm00200509ave/direct/01/



--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to