Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.programmer > #6718
| Date | 2011-08-01 16:13 -0700 |
|---|---|
| From | Patricia Shanahan <pats@acm.org> |
| Newsgroups | comp.lang.java.programmer |
| Subject | Re: looping through a list, starting at 1 |
| References | <list-20110802003845@ram.dialup.fu-berlin.de> |
| Message-ID | <ktqdna1VDImdrqrTnZ2dnUVZ_uydnZ2d@earthlink.com> (permalink) |
On 8/1/2011 3:45 PM, Stefan Ram wrote:
> Assuming a list has a sufficient number of entries at run
> time, what should be prefered to assign a reference to each
> entry to »e«, starting at index 1:
>
> for( final E e : l.sublist( 1, l.size() ))...
>
> or
>
> for( int i = 1; i< l.size(); ++i ){ final E e = l.get( 0 ); ... }
>
> ?
>
This is the sort of situation in which I try writing a comment, even if
I don't leave it in the code. The form that makes the comment easier to
write is the one that better models programmer intent.
Patricia
Back to comp.lang.java.programmer | Previous | Next — Next in thread | Find similar
Re: looping through a list, starting at 1 Patricia Shanahan <pats@acm.org> - 2011-08-01 16:13 -0700 Re: looping through a list, starting at 1 Arved Sandstrom <asandstrom3minus1@eastlink.ca> - 2011-08-01 21:27 -0300
csiph-web