<Swing Dev> Integrated: 8258006: Replaces while cycles with iterator with enhanced for in java.desktop
Andrey Turbanov
github.com+741251+turbanoff at openjdk.java.net
Sat Dec 19 22:22:56 UTC 2020
On Wed, 2 Dec 2020 19:23:28 GMT, Andrey Turbanov <github.com+741251+turbanoff at openjdk.org> wrote:
> There are few places in code where manual `while` loop is used with `Iterator` to iterate over `Collection`.
> Instead of manual `while` cycles it's preferred to use _enhanced-for_ cycle instead: it's less verbose, makes code easier to read and it's less error-prone.
> It doesn't have any performance impact: java compiler generates similar code when compiling _enhanced-for_ cycle.
>
> See similar cleanup in C++ code - #1707
This pull request has now been integrated.
Changeset: 580af490
Author: Andrey Turbanov <turbanoff at gmail.com>
Committer: Sergey Bylokhov <serb at openjdk.org>
URL: https://git.openjdk.java.net/jdk/commit/580af490
Stats: 167 lines in 25 files changed: 0 ins; 99 del; 68 mod
8258006: Replaces while cycles with iterator with enhanced for in java.desktop
Reviewed-by: prr, serb
-------------
PR: https://git.openjdk.java.net/jdk/pull/1574
More information about the swing-dev
mailing list