Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.gui > #1561
| From | "Michael Dunn" <michael.dunn@THRWHITE.remove-dii-this> |
|---|---|
| Subject | Re: Help with code |
| Message-ID | <4638643d@dnews.tpgi.com.au> (permalink) |
| Newsgroups | comp.lang.java.gui |
| References | <46384a5e$0$19254$da0feed9@news.zen.co.uk> |
| Date | 2011-04-27 15:34 +0000 |
| Organization | TDS.net |
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
Back to comp.lang.java.gui | Previous | Next | Find similar | Unroll thread
Re: Help with code "Michael Dunn" <michael.dunn@THRWHITE.remove-dii-this> - 2011-04-27 15:34 +0000
csiph-web