On Tue, 12 Oct 2021 05:49:17 GMT, Sergey Bylokhov <s...@openjdk.org> wrote:
>> Cycles with 'Iterator' are error-prone. It's better to use more high-level >> code, which easier to read. >> We can use enhanced-for or Collection.removeIf > > src/java.desktop/unix/classes/sun/awt/X11/ListHelper.java line 569: > >> 567: >> 568: private boolean isItemSelected(int index) { >> 569: for (Integer val : selected) { > > In some other places you did unboxing for the loop var, why not in this place? I tried to mimic original code. If in original code iterator.next() was assigned to a primitive - I use primitive for loop variable declaration. ------------- PR: https://git.openjdk.java.net/jdk/pull/5871