RFR: 8357226: Remove unnecessary List.indexOf from RepaintManager.removeInvalidComponent
Andrey Turbanov
aturbanov at openjdk.org
Mon May 19 08:26:28 UTC 2025
On Mon, 28 Apr 2025 23:48:04 GMT, Sergey Bylokhov <serb at openjdk.org> wrote:
>> No need to call `List.indexOf(Object)` before `List.remove(int)`. Instead we can call `List.remove(Object)` directly. It's faster and cleaner.
>> `invalidComponents` is an ArrayList.
>
> src/java.desktop/share/classes/javax/swing/RepaintManager.java line 394:
>
>> 392: }
>> 393: if (invalidComponents != null) {
>> 394: invalidComponents.remove(component);
>
> I guess the `addInvalidComponent` above can be simplified as well?
Simplified how?
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/24845#discussion_r2066621174
More information about the client-libs-dev
mailing list