代码改变世界

System.arraycopy与Arrays.copyOf区别

2020-09-13 11:56  Spiderman25  阅读(80)  评论(0)    收藏  举报

System
public static native void arraycopy(Object src,int srcPos, Object dest, int destPos,int length);

Arrays.copyOf()
copyOf(U[] original, int newLength, Class<? extends T[]> newType)

Arrays.copyOf底层调用System.arraycopy,在里面新增数组然后返回

都是复制地址