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


Groups > comp.lang.java.programmer > #6718

Re: looping through a list, starting at 1

Path csiph.com!x330-a1.tempe.blueboxinc.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!border3.nntp.dca.giganews.com!Xl.tags.giganews.com!border1.nntp.dca.giganews.com!nntp.giganews.com!local2.nntp.dca.giganews.com!nntp.earthlink.com!news.earthlink.com.POSTED!not-for-mail
NNTP-Posting-Date Mon, 01 Aug 2011 18:13:04 -0500
Date Mon, 01 Aug 2011 16:13:08 -0700
From Patricia Shanahan <pats@acm.org>
User-Agent Mozilla/5.0 (Windows NT 5.2; WOW64; rv:5.0) Gecko/20110624 Thunderbird/5.0
MIME-Version 1.0
Newsgroups comp.lang.java.programmer
Subject Re: looping through a list, starting at 1
References <list-20110802003845@ram.dialup.fu-berlin.de>
In-Reply-To <list-20110802003845@ram.dialup.fu-berlin.de>
Content-Type text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding 8bit
Message-ID <ktqdna1VDImdrqrTnZ2dnUVZ_uydnZ2d@earthlink.com> (permalink)
Lines 19
X-Usenet-Provider http://www.giganews.com
NNTP-Posting-Host 70.230.200.54
X-Trace sv3-KcLbaEiivXsOO+PslXBMG7A88lz7CIaK8T6JmGPkg+g+kQklQbIp3TQf5F8WNuYDz5Ffj5tERWjgShS!kOnuz/cn1TRnIozsZNVg4AzJQmNQjQSv+p/RHUQdVuqLVbTe0wY84IfPicrVZ+iJgeEDUrL7IJcs!gN4h2pp4KLCfeno1KqE8K+nim+sjrDS2LqOXMNKPhHi0Tw==
X-Abuse-and-DMCA-Info Please be sure to forward a copy of ALL headers
X-Abuse-and-DMCA-Info Otherwise we will be unable to process your complaint properly
X-Postfilter 1.3.40
X-Original-Bytes 1766
Xref x330-a1.tempe.blueboxinc.net comp.lang.java.programmer:6718

Show key headers only | View raw


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 | NextNext in thread | Find similar


Thread

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