On Thu, 23 Sep 2021 20:42:48 GMT, Andrey Turbanov <github.com+741251+turban...@openjdk.org> wrote:
> There are few places in code where manual `for` loop is used with Iterator to > iterate over Collection. > Instead of manual `for` 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. > Sometimes we even don't need cycle at all: we can just create one ArrayList > as a copy of another. > It doesn't have any performance impact: java compiler generates similar code > when compiling enhanced-for cycle. > This is continuation of > [JDK-8273261](https://bugs.openjdk.java.net/browse/JDK-8273261) This pull request has now been integrated. Changeset: baafa605 Author: Andrey Turbanov <turban...@gmail.com> Committer: Weijun Wang <wei...@openjdk.org> URL: https://git.openjdk.java.net/jdk/commit/baafa6059e7aa50978b0b29946fddb8b198a28d2 Stats: 32 lines in 4 files changed: 0 ins; 14 del; 18 mod 8274237: Replace 'for' cycles with iterator with enhanced-for in java.base Reviewed-by: dfuchs, weijun ------------- PR: https://git.openjdk.java.net/jdk/pull/5665