public synchronized E set(int index, E e) {Object[] newElements = elements.clone();@SuppressWarnings("unchecked")E result = (E) newElements[index];newElements[index] = e;elements = newElements;return result;}

public virtual E set(int index, E e){lock (this){object[] newElements = (object[])elements.Clone();E result = (E)newElements[index];newElements[index] = e;elements = newElements;return result;}}
