public synchronized void add(int index, E e) {Object[] newElements = new Object[elements.length + 1];System.arraycopy(elements, 0, newElements, 0, index);newElements[index] = e;System.arraycopy(elements, index, newElements, index + 1, elements.length - index);elements = newElements;}
public virtual void add(int index, E e){lock (this){object[] newElements = new object[elements.Length + 1];System.Array.Copy(elements, 0, newElements, 0, index);newElements[index] = e;System.Array.Copy(elements, index, newElements, index + 1, elements.Length - index);elements = newElements;}}