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


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

Re: looping through a list, starting at 1

Date 2011-08-05 10:39 -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> <6c7f77ed-569f-47b0-a83a-931e4fa7a544@e7g2000vbw.googlegroups.com>
Message-ID <5pydnY7yVuQkt6HTnZ2dnUVZ_rudnZ2d@earthlink.com> (permalink)

Show all headers | View raw


On 8/5/2011 2:11 AM, Raymond Tong wrote:
> It depends on the implmentation of list.

It shouldn't.

> If the list implements RandomAccess interface, it is recommended to
> call get(i) instead of using iterator().

Why?

I'm dealing right now with some code that followed that advice, so that
changes will be needed throughout the code to change the choice of List
implementation. The only reason random access is needed is because of
code that could have used iterator(), but didn't.

Patricia

Back to comp.lang.java.programmer | Previous | NextPrevious in thread | Find similar


Thread

Re: looping through a list, starting at 1 Raymond Tong <raytong82@gmail.com> - 2011-08-05 02:11 -0700
  Re: looping through a list, starting at 1 Patricia Shanahan <pats@acm.org> - 2011-08-05 10:39 -0700

csiph-web