<Sound Dev> RFR: 8271603: Unnecessary Vector usage in java.desktop [v4]
serb at openjdk.java.net
Fri Aug 27 17:10:30 UTC 2021
On Wed, 25 Aug 2021 17:53:00 GMT, Andrey Turbanov <github.com+741251+turbanoff at openjdk.org> wrote:
>> Usage of thread-safe collection `Vector` is unnecessary. It's recommended to use `ArrayList` if a thread-safe implementation is not needed. In post-BiasedLocking times, this is gets worse, as every access is synchronized.
>> I checked only places where `Vector` was used as local variable.
> Andrey Turbanov has updated the pull request incrementally with one additional commit since the last revision:
> 8271603: Unnecessary Vector usage in java.desktop
> migrate even more usages
src/java.desktop/share/classes/javax/swing/JMenu.java line 1340:
> 1338: }
> 1339: MenuElement me = new MenuElement[elements.size()];
> 1340: elements.toArray(me);
Implementation of the "toArray()" is not equivalent of "copyInto()". Maybe no-arg "return elements.toArray()" will look better. Same comment about other removed usage of copyInto
More information about the sound-dev