[opencms-dev] Ver6: Article Management Module is out!!!

Robert Burén robert.buren at gmail.com
Mon Feb 7 16:52:24 CET 2005


Ok, this is silly, but...

Boolean.valueOf() doesn't actually create a new instance of Boolean.
It returns either Boolean.TRUE or Boolean.FALSE, which are public
static final members of Boolean.

And so, your code isn't actually even slighter more efficient and the
code should be written like Alexander said, simply because that's what
those methods are there for, and the code is clearer.

Again -- silly. Nothing to get too exited about...

:-)

/Robert




On Mon, 07 Feb 2005 16:34:47 +0100, Robert Petermeier <robert2.0 at gmx.de> wrote:
> Hi Alex!
> 
> Alexander Kandzior schrieb:
> > Instead of
> >
> > boolean openInNewWindow = (s != null && s.equalsIgnoreCase("true"))
> >
> > I recommend writing it like this:
> >
> > boolean openInNewWindow = Boolean.valueOf(s).booleanValue();
> 
> That should yield exactly the same result but creates one more Boolean
> object that has to be garbage-collected, so I was assuming my code was
> slightly more efficient;-)
> 
> Regards,
> Robert
> 
> 
> _______________________________________________
> This mail is send to you from the opencms-dev mailing list
> To change your list options, or to unsubscribe from the list, please visit
> http://mail.opencms.org/mailman/listinfo/opencms-dev
>



More information about the opencms-dev mailing list