Time cost of addAll () method of list in Java

public boolean addAll(Collection<? extends E> c) {
    Object[] a = c.toArray();
    int numNew = a.length;
    ensureCapacityInternal(size + numNew);  // Increments modCount
    System.arraycopy(a, 0, elementData, size, numNew);
    size += numNew;
    return numNew != 0;
}

I see that the time cost of addAll () is proportional to the number of inserts. I think it should be the same no matter how many inserts it is, or what is the mystery of System.arraycopy, the native method? please explain

Mar.07,2021

A new array is generated when inserted, and there is a copy operation. The larger the array, the longer it takes.

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1e463d7-43856.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1e463d7-43856.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?