Difference between ArrayBlockingQueue and ArrayDeque


ArrayBlockingQueue stores elements in FIFO order. Insertion of element always happened at the tail of the queue and removal of the element always happened from the head of the queue.  It is thread safe and It is bounded array queue therefore once created, the capacity cannot be changed. It is the implementation of the Blocking queue.

As per Java Docs −

Resizable-array implementation of the Deque interface. Array deques have no capacity restrictions; they grow as necessary to support usage. They are not thread-safe; in the absence of external synchronization, they do not support concurrent access by multiple threads. Null elements are prohibited. This class is likely to be faster than Stack when used as a stack, and faster than LinkedList when used as a queue.

Sr. No.KeyArrayBlockingQueueArrayDeque
1
Basic
It implements BlockingQueue interface
It implements Deque interface
2Bounded
It is bounded array queue. Therefore Once created, the capacity cannot be change
It is resizable-array implementation of the Deque
3Thread Safe
It is thread safe
It is not thread safe
4

Insertion /Removal
Insertion of element always happened at the tail of the queue and removal of the element always happened from the head of the queue
It supports element insertion and removal at both ends

Updated on: 27-Jan-2020

320 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements