Code example for ArrayDeque

0
 
/** 
 * @author 
 */ 
public class DequeStack<E> implements Stack<E> {
    private Deque<E> deque = new ArrayDeque<E>();
    public E peek() { 
        return deque.peekLast();
    } 
 
    public void push(E e) {
        deque.addLast(e);
    } 
 
    public E pop() { 
        return deque.pollLast();
    } 
 
    public int size() { 
        return deque.size();
    }