<AWT Dev> RFR: 8271603: Unnecessary Vector usage in java.desktop [v4]
    Andrey Turbanov 
    github.com+741251+turbanoff at openjdk.java.net
       
    Fri Aug 27 17:55:24 UTC 2021
    
    
  
On Fri, 27 Aug 2021 17:04:33 GMT, Sergey Bylokhov <serb at openjdk.org> wrote:
>> 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
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

-------------
PR: https://git.openjdk.java.net/jdk/pull/4680
    
    
More information about the awt-dev
mailing list