lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Toke Eskildsen>
Subject Re: [jira] Created: (LUCENE-1257) Port to Java5
Date Fri, 04 Apr 2008 08:40:16 GMT
On Wed, 2008-04-02 at 09:30 -0400, Mark Miller wrote:
> > - replacement of indexed for loops with for each constructs
> Is this always the best idea? Doesn't the for loop construct make an
> iterator, which can be much slower than an indexed for loop?

Only in the case of iterations over collections. For arrays, the foreach
is syntactic sugar for indexed for-loop.

Whether or not using an iterator for e.g. ArrayList is better than an
indexed for-loop is another question. This is the old problems of
balancing general code vs. performance: An indexed for-loop might be
faster than an iterator for ArrayList, but it is definitely slower for

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message