@Override public E set(int index, E object) {synchronized (CopyOnWriteArrayList.this) {slice.checkElementIndex(index);slice.checkConcurrentModification(elements);E result = CopyOnWriteArrayList.this.set(index + slice.from, object);slice = new Slice(elements, slice.from, slice.to);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;}}