copyTo method

void copyTo(
  1. int srcOffset,
  2. List<T> dst,
  3. int dstOffset,
  4. int length,
)

Copy length from srcOffset of this List to dst at dstOffset.

  • This is the classic C/C++ buffer copy style.

Implementation

void copyTo(int srcOffset, List<T> dst, int dstOffset, int length) {
  if (srcOffset == 0 && length == this.length) {
    dst.setAll(dstOffset, this);
  } else {
    dst.setRange(dstOffset, dstOffset + length, this, srcOffset);
  }
}