[PATCH] 8173962: Add API for Deep copy of multi-dimensional arrays

Alan Bateman Alan.Bateman at oracle.com
Wed Jan 11 14:09:12 UTC 2023


On 11/01/2023 12:45, Fabio Romano wrote:
> Added the methods deepCopyOf(U[] original, Class<? extends T[]> 
> newType) and deepCopyOf(T[] original), that perform a deep copy of the 
> structure of multidimensional arrays. Also, added a pre-calculation of 
> the string builders capacity for toString() of primitive array types, 
> based on the mold of BitSet.toString() method for pre-calculation of 
> the initial capacity.
>
> The deep copy is necessary for coping a multiarray that should be 
> assigned to a field or returned by a getter method, to ensure that the 
> data structure will not be modified externally of the class.

This isn't really the right mailing list to discuss proposals for new 
APIs. Can you bring an outline of your proposal to core-libs-dev for 
discussion? Also if haven't done so already, go through Stuart's 
comments from 2017 in the JBS issue as there were concerns at the time.

-Alan



More information about the jdk-dev mailing list