<i18n dev> RFR: 8271603: Unnecessary Vector usage in java.desktop [v4]

Andrey Turbanov github.com+741251+turbanoff at openjdk.java.net
Wed Sep 1 19:30:11 UTC 2021


On Fri, 27 Aug 2021 18:28:58 GMT, Sergey Bylokhov <serb at openjdk.org> wrote:

>> Can you please elaborate?
>> As I can see if size of array is exactly the same as size of vector/arraylist, implementations are similar - they just call System.arraycopy
>> ![изображение](https://user-images.githubusercontent.com/741251/131168809-480c05d6-2775-4812-91f5-c73833f9a396.png)
>
> To confirm this you need to do the same check on every usage of added toArray([]), the simpler version like "return toArray()" or return toArray(new MenuElement[elements.size()]) is simpler, no need to check something. I guess in some previouse fixes it was confirmed that the "return toArray(new MenuElement[0])" is even faster.

Ok. Simplified

-------------

PR: https://git.openjdk.java.net/jdk/pull/4680


More information about the i18n-dev mailing list