title: Why should I use Deque over Stack?
body: <p>I need a <code>Stack</code> data structure for my use case. I should be able to push items into the data structure and I only want to retrieve the last item from the Stack. The <a href="http://grepcode.com/file/repository.grepcode.com/java/root/jdk/openjdk/6-b14/java/util/Stack.java#Stack" rel="noreferrer">JavaDoc for Stack</a> says :</p>
  
  <blockquote>
    <p>A more complete and consistent set of LIFO stack operations is
    provided by the Deque interface and its implementations, which should
    be used in preference to this class. For example:</p>
  </blockquote>
  
  <pre><code>Deque&lt;Integer&gt; stack = new ArrayDeque&lt;&gt;();
  </code></pre>
  
  <p>I definitely do not want synchronized behavior here as I will be using this datastructure local to a method . Apart from this why should I prefer <code>Deque</code> over <code>Stack</code> here ?</p>
  
  <p>P.S: The javadoc from Deque says :</p>
  
  <blockquote>
    <p>Deques can also be used as LIFO (Last-In-First-Out) stacks. This
    interface should be used in preference to the legacy Stack class.</p>
  </blockquote>