title: get() or elementAt() in Java
body: <p>Which is faster and takes less amount of time (in nanoseconds) in JAVA between the two?</p>
  
  <p><code>get()</code> or <code>elementAt()</code></p>
  
  <p>I'm using them to return element stored in an object. And speed is critical, therefore I wanted to know which is more feasible and faster amongst the two.</p>
  
  <pre><code>public E peek() {
          int len = size();
          if (len == 0)
              throw new EmptyStackException();
          return get(len - 1);
  }
  </code></pre>
  
  <p>or </p>
  
  <pre><code>public E peek() {
              int len = size();
              if (len == 0)
                  throw new EmptyStackException();
              return elementAt(len - 1);
  }
  </code></pre>