copy static method

List copy(
  1. List src,
  2. int srcStart,
  3. List dst,
  4. int dstStart,
  5. int count,
)

Copy a list (src) to another (dst)

Implementation

static List copy(List src, int srcStart,
                 List dst, int dstStart, int count) {
  if (srcStart < dstStart) {
    for (int i = srcStart + count - 1, j = dstStart + count - 1;
         i >= srcStart; i--, j--) {
      dst[j] = src[i];
    }
  } else {
    for (int i = srcStart, j = dstStart; i < srcStart + count; i++, j++) {
      dst[j] = src[i];
    }
  }
  return dst;
}