>
> In our projects, we have style checks that suggest "for (x in y) ..." over
> "for (T x : y) ...".  The "in" form is groovy idiom and the ":" form is for
> java compat.  Switching to use "y.each { x-> ... }" or "y.forEach(x ->
> ...)" is a personal preference.  Note: the debugger steps through the for
> loop much more easily.
>

I agree 100%, we migrated all ".each" to "if (x in y)" in our code base
years ago because of the debugger not getting into the loops and because we
noticed at the time that a new ".class" file was generated each time we
used ".each" (I don't know if it is still like that).

It reads a lot better as well in my opinion.

Reply via email to