Re: Java programming style question



In article <op.trs3fvbv8kxvgr@xxxxxxxxxxxxxxxxxxxxx>, "Daniel Dyer"
<"You don't need it"> says...
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

Yeah, I already learned that lesson :-D

IDEA suggests using .length() for performance reasons, but I doubt it
would make any noticeable difference in most cases.

That's kind of what I figured; thanks!

.....

--
Remove the ns_ from if replying by e-mail (but keep posts in the
newsgroups if possible).
.



Relevant Pages

  • Re: neck break
    ... Yeah, that's what I said. ... *More wide-eyed disbelief* ... That would be one lesson. ... I guess spitting in beer must be one of your local customs. ...
    (rec.martial-arts)
  • Re: [OT] Yoga
    ... But it felt really good, and when we were done, she told me that most of the clients she sees could never get as far with it as I could (yeah, maybe she just wanted me to take 2,000 lessons, but I don't think so). ... My friend got me the lesson because she figured it might do more for me than all the medical stuff. ... Back when I could still get up off the floor by myself, I got a lot of mileage out of yoga. ... I mastered the sponge. ...
    (rec.pets.cats.anecdotes)
  • Re: New metric or used HD?
    ... Yeah, me too. ... I learned my lesson years ago with an '88 CBR1000. ... today's bikes would leave that '88 in the dust. ... smile. ...
    (rec.motorcycles)
  • Re: [OT] Yoga
    ... yoga lesson, and I finally had it this week. ... just getting into breathing and allowing my ... could never get as far with it as I could (yeah, ...
    (rec.pets.cats.anecdotes)
  • Re: Commentary: The age of reason
    ... We taught them a lesson 1n 1918 and they've hardly bothered us ... Yeah, Nazi Germany was hardly any bother. ...
    (talk.origins)