RFR: 8274261: Use enhanced-for instead of plain 'for' in jdk.jcmd
Serguei Spitsyn
sspitsyn at openjdk.java.net
Mon Sep 27 09:05:02 UTC 2021
On Fri, 24 Sep 2021 09:01:28 GMT, Andrey Turbanov <github.com+741251+turbanoff at openjdk.org> wrote:
>> src/jdk.jcmd/share/classes/sun/tools/jstat/OptionFormat.java line 81:
>>
>>> 79:
>>> 80: for (Iterator<OptionFormat> i = children.iterator(); i.hasNext(); /* empty */) {
>>> 81: OptionFormat o = i.next();
>>
>> Why did not you simplify the lines 80-81 the same way as in line 85?
>
> It can't be simplified: it calls `Iterator.hasNext()` inside cycle body.
> `i.hasNext()` at line 82
Okay. Thank you for explanation.
-------------
PR: https://git.openjdk.java.net/jdk/pull/5673
More information about the serviceability-dev
mailing list