Deque.add(E e) has the following syntax.
boolean add(E e)
In the following code shows how to use Deque.add(E e) method.
/* w ww.j a v a 2 s. co m*/ import java.util.ArrayDeque; import java.util.Deque; public class Main { public static void main(String[] args) { Deque<Integer> deque = new ArrayDeque<Integer> (5); deque.add(20); deque.add(30); deque.add(20); deque.add(30); deque.add(15); deque.add(22); deque.add(11); System.out.println(deque); } }
The code above generates the following result.