Re: Beginner Projects
- From: Roedy Green <see_website@xxxxxxxxxxxxxxxxxxxx>
- Date: Thu, 30 Aug 2007 03:58:39 GMT
On Wed, 29 Aug 2007 21:23:06 +0000 (UTC), Pseudo Silk Kimono
<Pseudo_Silk_Kimono@xxxxxxxxxxxxx> wrote, quoted or indirectly quoted
someone who said :
if ( (intValue % 2) == 0 )
this.isEven = true;
else
this.isEven = false;
I would collapse this to:
this.isEven = ( intValue %2 ) == 0;
Most likely isEven could be made local. Then you could shorten it
further to:
isEven = ( intValue & 1 ) == 0;
--
Roedy Green Canadian Mind Products
The Java Glossary
http://mindprod.com
.
- Follow-Ups:
- Re: Beginner Projects
- From: Pseudo Silk Kimono
- Re: Beginner Projects
- From: Lew
- Re: Beginner Projects
- References:
- Beginner Projects
- From: Pseudo Silk Kimono
- Beginner Projects
- Prev by Date: Re: Adding SCROLLBARS to a JTextArea
- Next by Date: Re: Beginner Projects
- Previous by thread: Re: Beginner Projects
- Next by thread: Re: Beginner Projects
- Index(es):
Relevant Pages
|