Code example for ArrayDeque

0
    private final ThreadLocal<Deque<E>> deque = new ThreadLocal<Deque<E>>();
 
    public void push(E item) {
        Deque<E> st = deque.get();
        if (st == null) {
            st = new ArrayDeque<E>();
            deque.set(st);
        } 
        st.push(item);
    } 
 
    public E peek() { 
        Deque<E> st = deque.get();
        if (st == null) {
            return null; 
        } 
        return st.peek();
    } 
 
    public E pop() {