Deque
Learn Deque (Queue / Deque, Data Structures & Algorithms) with worked examples, diagrams and interview questions. Free on JavaSchoolLab.
What is a Deque? A Deque (Double-Ended Queue) allows O(1) insertion AND removal at BOTH ends - it generalizes both a stack (use only one end) and a queue (use front for one op, back for the other). Java's Deque interface, backed by ArrayDeque , is genuinely the Swiss Army knife of the collections framework.