public synchronized E peek() {try {return (E) elementData[elementCount - 1];} catch (IndexOutOfBoundsException e) {throw new EmptyStackException();}}
public virtual E peek(){lock (this){try{return (E)elementData[elementCount - 1];}catch (System.IndexOutOfRangeException){throw new java.util.EmptyStackException();}}}