cur = cur.insert((ATerm)buffer.get(i));
cur = cur.insert((ATerm)buffer.get(lcv));
  public ATermList replace(ATerm el, int i)  {    int lcv;    List buffer;    ATermList cur;    if (0 > i || i > length) {      throw new IllegalArgumentException("illegal list index: " + i);    }    buffer = new Vector(i);    cur = this;    for (lcv=0; lcv<i; lcv++) {      buffer.add(cur.getFirst());      cur = cur.getNext();    }    /* Skip the old element */    cur = cur.getNext();    /* Add the new element */    cur = cur.insert(el);    /* Add the prefix */    for(--lcv; lcv>=0; lcv--) {      cur = cur.insert((ATerm)buffer.get(i));    }    return cur;  }