title: Removing a specific element in a stack
body: <p>I am trying to remove a specific element in a stack, but having some trouble. My thought would be to pop the elements on to a temporary stack, pop the index I am looking for and then pop the elements in my temporary stack back onto the main stack. I am having trouble conjuring up how I can get the temp stack back on top. Any help would be greatly appreciated.</p>
  
  <pre><code>public E remove(int index) {
      Stack&lt;E&gt; tmpStack = new Stack&lt;E&gt;();
      if (size() == 0) {
          return null;
      } else {
          for (int i = 0; i &lt; index; i++) {
              tmpStack.push(this.pop());
          }
          return tmpStack.pop();
      }
      while (!tmpStack.isEmpty())
          this.push(tmpStack.pop());
  }
  </code></pre>
  
  <p>Thoughts? Cheers!</p>