<Swing Dev> RFR: 8258006: Replaces while cycles with iterator with enhanced for in java.desktop [v2]
Andrey Turbanov
github.com+741251+turbanoff at openjdk.java.net
Tue Dec 15 15:24:03 UTC 2020
> 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
Andrey Turbanov has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains one commit:
8258006: Replace 'while' cycles with iterator with enhanced 'for' in java.desktop
-------------
Changes: https://git.openjdk.java.net/jdk/pull/1574/files
Webrev: https://webrevs.openjdk.java.net/?repo=jdk&pr=1574&range=01
Stats: 167 lines in 25 files changed: 0 ins; 99 del; 68 mod
Patch: https://git.openjdk.java.net/jdk/pull/1574.diff
Fetch: git fetch https://git.openjdk.java.net/jdk pull/1574/head:pull/1574
PR: https://git.openjdk.java.net/jdk/pull/1574
More information about the swing-dev
mailing list