Skip to content

Tag Archives: Java-BlockingQueue

The Producer-Consumer problem is a synchronization issue that arises when one or more threads generate data, placing it on a buffer, and simultaneously, one or… Read More
The remainingCapacity() method of BlockingQueue returns the number of more elements that can be added to BlockingQueue without blocking. The Capacity returned arises in three… Read More
The remove(Object obj) method of BlockingQueue removes only one instance of the given Object, passed as parameter, from this BlockingQueue if it is present. It… Read More
The take() method of BlockingQueue interface is used to retrieve and remove the head of this queue. If the queue is empty then it will… Read More
The drainTo(Collection col) method of BlockingQueue removes all available elements from this LinkedBlocking Queue and adds them to the given collection passed as a parameter.… Read More
There are two types of offer() method for BlockingQueue interface:Note: The offer() method of BlockingQueue has been inherited from the Queue class in Java.  offer(E… Read More
The put(E e) method of BlockingQueue interface inserts element passed as parameter to method at the tail of this BlockingQueue, if queue is not full.… Read More
The poll(long timeout, TimeUnit unit) method of BlockingQueue interface returns the head of BlockingQueue by removing that element from the queue. It can be said… Read More
The contains(Object o) method of BlockingQueue interface checks if the passed element in the parameter exists in the container or not. It returns true if… Read More
The add(E e) method of BlockingQueue interface inserts the element passed in the parameter to the end of the Queue is there is space. If… Read More
The BlockingQueue interface in Java is added in Java 1.5 along with various other concurrent Utility classes like ConcurrentHashMap, Counting Semaphore, CopyOnWriteArrrayList, etc. BlockingQueue interface… Read More

Start Your Coding Journey Now!