// using deque Deque<String> deque = new LinkedList<>(); deque.add("two"); deque.add("one"); deque.addFirst("three"); //prints "three", "two", "one"