LinkedTransferQueue in Java

LinkedTransferQueue in Java is an implementation of the TransferQueue interface and is part of java.util.concurrent package. It was added in Java 7. TransferQueue interface in Java TransferQueue interface which extends BlockingQueue interface adds the capability where producers may wait for consumers to receive elements. In BlockingQueue implementations like ArrayBlockingQueue, PriorityBlockingQueue…

Continue reading

LinkedBlockingDeque in Java

LinkedBlockingDeque in Java is an implementation of BlockingDeque interface and is part of java.util.concurrent package. LinkedBlockingDeque, just like LinkedBlockingQueue, is an optionally-bounded blocking queue which means the capacity for the queue can be specified thus making it bounded or it can be left unspecified in which case capacity of the…

Continue reading

DelayQueue in Java

DelayQueue in Java is an implementation of BlockingQueue interface and is part of java.util.concurrent package. DelayQueue in Java is an unbounded queue that’s where it differs from ArrayBlockingQueue which is a bounded queue. Delayed interface Java DelayQueue can store elements only of type Delayed. There is an interface Delayed in…

Continue reading

SynchronousQueue in Java

SynchronousQueue in Java is an implementation of BlockingQueue interface and is part of java.util.concurrent package. SynchronousQueue in Java is different from other BlockingQueue implementations like ArrayBlockingQueue and PriorityBlockingQueue because a synchronous queue does not have any internal capacity, not even a capacity of one. So, each insert operation in SynchronousQueue…

Continue reading

PriorityBlockingQueue in Java

PriorityBlockingQueue in Java is an implementation of BlockingQueue interface and is part of java.util.concurrent package. PriorityBlockingQueue is an unbounded queue PriorityBlockingQueue is logically unbounded, that’s how it differs from ArrayBlockingQueue which is a bounded queue and LinkedBlockingQueue which is optionally-bounded. PriorityBlockingQueue though unbounded is created with an initial capacity which…

Continue reading

LinkedBlockingQueue in Java

LinkedBlockingQueue in Java is an implementation of BlockingQueue interface and is part of java.util.concurrent package. LinkedBlockingQueue has the features of both ArrayBlockingQueue and DelayQueue. ArrayBlockingQueue is a bounded blocking queue where as DelayQueue is an unbounded blocking queue. LinkedBlockingQueue sits in the middle as it is an optionally-bounded blocking queue…

Continue reading

ArrayBlockingQueue in Java

ArrayBlockingQueue in Java is an implementation of BlockingQueue interface and is part of java.util.concurrent package. ArrayBlockingQueue is a bounded blocking queue which internally uses an array to store elements. This queue orders elements FIFO (first-in-first-out). The head of the queue is the element that has been on the queue the…

Continue reading