The
Java.util.concurrent.LinkedTransferQueue.hasWaitingConsumer() method always returns true if there is at least one consumer in the queue waiting to receive an element via BlockingQueue.take() or timed poll. The returned value represents a momentary state of affairs.
Syntax
public boolean hasWaitingConsumer()
Parameters: It does not take in any parameter.
Return Value: This method returns
a boolean value which is
true if at least one consumer is present in the queue.
Below are a few examples to illustrate the LinkedTransferQueue.hasWaitingConsumer() method:
Example 1:
Example 2: