Skip to content

Tag Archives: Java-PriorityBlockingQueue

PriorityBlockingQueue is an unbounded blocking queue that uses the same ordering rules as class PriorityQueue and supplies blocking retrieval operations. The “blocking” part of the… Read More
1. poll() Method The poll() method of PriorityBlockingQueue retrieves and removes element from head of this PriorityBlockingQueue. This method returns the element it removes from… Read More
The spliterator() method of PriorityBlockingQueue returns a Spliterator of the same elements as PriorityBlockingQueue. The returned iterator is weakly consistent. It can be used with… Read More
1. offer(E e) Method The offer(E e) method of PriorityBlockingQueue inserts the element e, passed as parameter, in this PriorityBlockingQueue.This method inserts the element into… Read More
The drainTo(Collection col) method of PriorityBlockingQueue removes all available elements from this LinkedBlocking Queue and adds them to the given collection passed as a parameter. … Read More
toArray() The toArray method of PriorityBlockingQueue is used to create an array having the same elements as that of this PriorityBlockingQueue, in proper sequence. Actually,… Read More
The size() method of PriorityBlockingQueue is used to find the present size of the queue. It returns the number of elements in the collection. If… Read More
The put(E e) method of PriorityBlockingQueue is used to add an element into this queue. This method inserts the specified element into this priority queue.… Read More
The remainingCapacity method of PriorityBlockingQueue is used to check how much more elements can be inserted into this queue. But since the PriorityBlockingQueue is unbounded,… Read More
The remove(Object o) method of PriorityBlockingQueue is used to delete an element from this queue. This method removes a single instance of the element passed… Read More
The iterator() method of PriorityBlockingQueue class Returns an iterator over the elements in this queue. The elements returned from this method do not follow any… Read More
The peek() method of PriorityBlockingQueue returns the element at head of the PriorityBlockingQueue. It retrieves the value of the head of LinkedBlockingQueue but does not… Read More
The take() method of PriorityBlockingQueue returns head of the queue after removing it. If queue is empty, then this method will wait until an element… Read More
The comparator() method of PriorityBlockingQueue returns the comparator that can be used to order the elements in a PriorityBlockingQueue. The method returns null value if… Read More
The toString() method of PriorityBlockingQueue returns String representation of this PriorityBlockingQueue showing details of element contained by PriorityBlockingQueue. The string of PriorityBlockingQueue contains elements of… Read More

Start Your Coding Journey Now!