Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.gui > #1561 > unrolled thread

Re: Help with code

Started by"Michael Dunn" <michael.dunn@THRWHITE.remove-dii-this>
First post2011-04-27 15:34 +0000
Last post2011-04-27 15:34 +0000
Articles 1 — 1 participant

Back to article view | Back to comp.lang.java.gui

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: Help with code "Michael Dunn" <michael.dunn@THRWHITE.remove-dii-this> - 2011-04-27 15:34 +0000

#1561 — Re: Help with code

From"Michael Dunn" <michael.dunn@THRWHITE.remove-dii-this>
Date2011-04-27 15:34 +0000
SubjectRe: Help with code
Message-ID<4638643d@dnews.tpgi.com.au>
  To: comp.lang.java.gui

"Ian Wilson" <scobloke2@infotop.co.uk> wrote in message 
news:46384a5e$0$19254$da0feed9@news.zen.co.uk...
> Michael Dunn wrote:
>
> <snippage>
>
> Expressions involving x and y tend to make me think of cartesian coordinates, I had to do a double 
> take to check you were using FlowLayout for the buttons and not GridLayout.
>
>>     for(int x= 0, y = btns.length; x < y; x++)
>
> Why not
>       for(int x = 0; x < btns.length; x++)
>
> I've always imagined that the compiler or JVM would do the obvious optimisation. Is there 
> something I'm missing?
>

absolutely no idea how the JVM optimises, I've just assumed that btns.length
would be called/evaluated on each loop and that it would be better to do this
only once. If it makes no difference, then
for(int x = 0; x < btns.length; x++)
is a simpler way to do it.

---
 * Synchronet * The Whitehouse BBS --- whitehouse.hulds.com --- check it out free usenet!
--- Synchronet 3.15a-Win32 NewsLink 1.92
Time Warp of the Future BBS - telnet://time.synchro.net:24

[toc] | [standalone]


Back to top | Article view | comp.lang.java.gui


csiph-web