Antoine Levy-Lambert wrote:

I also think that the code was more readable before. The variable
myTokenizer or tzr being a variable of a private function goes quickly
out of scope anyway.

Something like this would alleviate the remark of Martijn concerning
where the incrementation takes place but does not seem to be proper java
syntax.
for (StringTokenizer tzr = new StringTokenizer(path, File.pathSeparator)
&& String elementName = tzr.nextToken();
tzr.hasMoreElements();elementName = tzr.nextToken()) {
To be honest I don't really like this for loop either, the && in the initializer of the loop doesn't make it more readable. My general feeling is that "funny" constructs used to reduce scope by just defining something inside the loop control statement is that in that case a method should be used to reduce the lifetime and scope of a variable.

In the case of the changed loop, the scope of the variable was not reduced by any statement. (Method terminates directly after the last statement of the loop.)

Generally I am more in favour of creating an extra method, than to introduce unclear constructs to reduce scope.
(And in this case the method is already limited to the action in the loop.)

Martijn

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

Reply via email to