-
int[] arr2=new int[arr1.length*2] //新数组长度 for(int i=0;i<arr1.length;i++){ //复制 arr2[i]=arr1[i]; }
-
int[] arr2=java.util.Arrays.copyOf(原数组名,新数组长度);
-
int[] arr2=new int[arr1.length*2] System.arraycopy(原数组名,起始下标,新数组名,起始下标,复制长度);
关于LIST扩容的三种方式(转载自https://blog.csdn.net/wt122694/article/details/81173128)
猜你喜欢
转载自blog.csdn.net/zyupupup/article/details/84238227
今日推荐
周排行