List of usage examples for java.util ArrayDeque ArrayDeque
public ArrayDeque(Collection<? extends E> c)
From source file:Main.java
public static void main(String[] args) { Deque<Integer> deque = new ArrayDeque<Integer>(8); deque.add(1);//from w w w . ja va 2 s.co m deque.add(2); deque.add(3); deque.add(4); deque.offerFirst(10); System.out.println(deque); }
From source file:Main.java
public static void main(String[] args) { Deque<Integer> deque = new ArrayDeque<Integer>(8); deque.add(1);//w ww. ja va 2s. c o m deque.add(2); deque.add(3); deque.add(4); deque.offerLast(5); System.out.println(deque); }
From source file:Main.java
public static void main(String[] args) { ArrayDeque<Integer> deque = new ArrayDeque<Integer>(8); deque.add(3);/* w w w . jav a2 s .c o m*/ deque.add(18); deque.add(25); deque.add(18); System.out.println(deque); }
From source file:Main.java
public static void main(String[] args) { Deque<Integer> deque = new ArrayDeque<Integer>(8); deque.add(1);//from w ww . java 2 s . co m deque.add(2); deque.add(3); deque.add(4); System.out.println(deque); int retval = deque.element(); System.out.println("Retrieved Element is = " + retval); }
From source file:Main.java
public static void main(String[] args) { Deque<Integer> deque = new ArrayDeque<Integer>(8); deque.add(1);/*from w w w. j a v a 2 s. c om*/ deque.add(2); deque.add(3); // adding elements using push() method deque.push(4); deque.push(5); System.out.println(deque); }
From source file:Main.java
public static void main(String[] args) { Deque<Integer> deque = new ArrayDeque<Integer>(8); deque.add(1);//from ww w . ja va 2 s . c o m deque.add(2); deque.add(4); deque.add(5); int retval = deque.peekFirst(); System.out.println("Retrieved Element is " + retval); System.out.println(deque); }
From source file:Main.java
public static void main(String[] args) { Deque<Integer> deque = new ArrayDeque<Integer>(8); deque.add(1);//from ww w. jav a2s . c o m deque.add(2); deque.add(3); deque.add(4); int retval = deque.peek(); System.out.println("Retrieved Element is " + retval); System.out.println(deque); }
From source file:Main.java
public static void main(String[] args) { Deque<Integer> deque = new ArrayDeque<Integer>(8); deque.add(15);//from w w w . j a v a 2 s . co m deque.add(20); deque.add(25); deque.add(20); // this will remove first occurrence of element 20 deque.removeFirstOccurrence(20); System.out.println(deque); }
From source file:Main.java
public static void main(String[] args) { Deque<Integer> deque = new ArrayDeque<Integer>(5); deque.add(20);//from w ww.j ava 2 s. com deque.add(30); deque.add(20); deque.add(30); deque.add(15); deque.add(22); deque.add(11); System.out.println(deque); }
From source file:Main.java
public static void main(String[] args) { Deque<Integer> deque = new ArrayDeque<Integer>(8); deque.add(1);//from www. j av a 2 s .co m deque.add(2); deque.add(3); deque.add(4); int retval = deque.peekLast(); System.out.println("Retrieved Element is " + retval); System.out.println(deque); }