Exemple #1
0
 @Override
 public void set(int index, Integer e) {
   if (index >= size) {
     size = index + 1;
   }
   if (index >= box.length) {
     ensureNMore(index + 1 - box.length);
   }
   box[index] = e;
 }
Exemple #2
0
 @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;
 }
Exemple #3
0
 @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;
 }