title: How to make pop() method to return and delete the second element in the stack?
body: <p>I wrote an implementation of a <code>Stack</code> using Linked Nodes, but I want to add a method next to <code>pop()</code> that will remove the second item of the <code>Linkedstack</code> not the top item. I know that the point of implementing a stack is to only be able to remove the top item, but I need to implement this method.</p>
  
  <p>This is the code for the <code>pop()</code> method I already have:</p>
  
  <pre><code>public T pop() {
      T top = peek();
      if (topNode != null)
          topNode = topNode.getNextNode();
      return top;
  }
  </code></pre>
  
  <p>So what I want to do is let a new <code>node</code> point to the second element in the chain so I can return its value and then make <code>topNode</code> point to the first node as it is and then have that first node pointing to the third node in the chain so the second is deleted.</p>