text: 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;}