Martijn Kruithof wrote:

Hi,

I think the while construct is cleaner and more readable, and do not see any real benefit of this code change. Especially against using the for loop is that when using the for loop the step of the loop should take place in the third part of the for, and not somewhere inside the for loop.

My reason for the change was that with the while construct, the scope of the tokenizer variable is larger than is necessary - ie it is only used within the loop, yet it is declared outside the loop.

The idiom I was using when making this change is similar to

for (Iterator i = list.iterator(); i.hasNext();) {
 Stuff s = (Stuff)i.next();
...
}

Which is fairly common usage - ignoring the last element of the for

What's the position of other committers on this?

I'd be interested to hear other opinions too, after all I only changed the code as I (perhaps mistakenly) thought that having a larger than necessary scope is generally a bad thing

Martijn


Thanks for the comments

Kev


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to