LinkedBlockingQueue API is an optionally-bounded queue based on linked nodes. It orders the elements in FIFO(First In First Out) order. The head of this queue… Read More
Tag Archives: Java-LinkedBlockingQueue
ArrayBlockingQueue and LinkedBlockingQueue in Java Collection are the common implementations of the BlockingQueue interface. ArrayBlockingQueue: ArrayBlockingQueue is a class in Java that implements the BlockingQueue… Read More
The toString() method of LinkedBlockingQueue returns a string representation of this collection. The string representation consists of a list of the collection’s elements in the… Read More
The LinkedBlockingQueue is an optionally-bounded blocking queue based on linked nodes. It means that the LinkedBlockingQueue can be bounded, if its capacity is given, else… Read More
The take() method of LinkedBlockingQueue is used to retrieve and remove the head of this queue. If the queue is empty then it will wait… Read More
The toString() method of LinkedBlockingQueue returns a String representation of the elements of LinkedBlockingQueue. The string of LinkedBlockingQueue contains its elements from first(head) to last(tail),… Read More
The put(E e) method of LinkedBlockingQueue inserts element passed as parameter to method at the tail of this LinkedBlockingQueue, if queue is not full. If… Read More
The spliterator() method of LinkedBlockingQueue returns a Spliterator of the same elements as LinkedBlockingQueue. The returned iterator is weakly consistent. It can be used with… Read More
There is two types of poll() method in LinkedBlockingQueue. poll() The poll() method of LinkedBlockingQueue returns the head of LinkedBlockingQueue by removing that element from… Read More
There is two types of offer() method for LinkedBlockingQueue class : offer(E e, long timeout, TimeUnit unit) The offer(E e, long timeout, TimeUnit unit) method… Read More
The drainTo(Collection col) method of LinkedBlockingQueue 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 LinkedBlockingQueue is used to create an array having the same elements as that of this LinkedBlockingQueue, in proper sequence. Actually,… Read More
The iterator() method of LinkedBlockingQueue returns an iterator of the same elements, as this LinkedBlockingQueue, in a proper sequence. The elements returned from this method… Read More
The peek() method of LinkedBlockingQueue returns the head of the LinkedBlockingQueue. It retrieves the value of the head of LinkedBlockingQueue but does not remove it.… Read More
The remainingCapacity() method of LinkedBlockingQueue returns the number of more elements that can be added to LinkedBlockingQueue without blocking. The Capacity returned arises three cases:… Read More