Java ArrayBlockingQueue

ArrayBlockingQueue is an implementation of the BlockingQueue, Which is backed by the Array Data Structure. ArrayBlockingQueue can be initialized by the specified limit.

Specified limit should be with in the limit of primitive data type int , the following are constructors of the ArrayBlockingQueue.

capacity is the limit in terms of how many elements can be inserted in ArrayBlockingQueue at max, fair is true means queue accessed will be done in the FIFO otherwise order policy will be unspecified and Collection is the list of elements which needs to be inserted into the queue at the time of initialization.

This Collection size should be less than the capacity of the ArrayBlockingQueue otherwise this will lead to an IllegalArgumentException.

The following are the most commonly used methods in the ArrayBlockingQueue.

Insert Operation

Remove Operation

Examine Operation