@Override PList<Integer> createBigList(int size, int delta) { int[] memory = new int[size - delta]; int b = 3; IntList fl = new IntList(memory, size - delta); for (int i = size - delta; i < size + delta; i++) { fl.add(i + b); } return fl; }
@Override public PList<Integer> extendAt(int i, PList<Integer> extra) { if (extra instanceof IntList) { IntList other = (IntList) extra; ensureNMore((other.size() + i) - this.size()); System.arraycopy(other.box, 0, box, i, extra.size()); if (i + other.size > size) size = i + other.size; } else { for (Integer b : extra) { this.set(i, b); } } return null; }
@Override public PList<Integer> extend(PList<Integer> extra) { if (extra instanceof IntList) { IntList other = (IntList) extra; ensureNMore(other.size()); System.arraycopy(other.box, 0, box, size, extra.size()); size += other.size; } else { for (Integer b : extra) { this.add(b); } } return null; }