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

Marker Interface in Java

Marker interface in Java is an interface with empty body. A marker interface does not contain constants or methods, examples of marker interface in Java are- java.util.RandomAccess java.rmi.Remote java.io.Serializable java.lang.Cloneable Marker interface adds special behavior Since marker interface is an empty interface so there are no methods to implement. It…

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 DelayQueue can store elements only of type Delayed. There is an interface Delayed in Java…

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