List of usage examples for java.util ArrayDeque offerLast
public boolean offerLast(E e)
From source file:Main.java
public static void main(String[] args) { ArrayDeque<Integer> deque = new ArrayDeque<Integer>(8); deque.add(25);// w w w. j a v a 2 s . c o m deque.add(2); deque.add(1); deque.add(18); // this will insert 40 at the end deque.offerLast(40); System.out.println(deque); }
From source file:com.google.gwt.emultest.java.util.ArrayDequeTest.java
public void testOfferLast() { Object o1 = new Object(); Object o2 = new Object(); Object o3 = new Object(); ArrayDeque<Object> deque = new ArrayDeque<>(); assertTrue(deque.offerLast(o1)); checkDequeSizeAndContent(deque, o1); assertTrue(deque.offerLast(o2));/*from ww w. j av a2 s . c om*/ checkDequeSizeAndContent(deque, o1, o2); assertTrue(deque.offerLast(o3)); checkDequeSizeAndContent(deque, o1, o2, o3); try { deque.offerLast(null); fail(); } catch (NullPointerException expected) { } }