Java ConcurrentLinkedQueue remove() MethodThe remove() method of ConcurrentLinkedQueue class removes the specified element from the queue if that element is present in the queue. Syntax:Parameters:The parameter 'o' is the element to be removed from the queue if it is present. Specified By:The remove () method of ConcurrentLinkedQueue class is specified by:
Overrides:The remove () method of ConcurrentLinkedQueue class overrides:
Return Value:The remove() method returns a Boolean value corresponding to this Object 'o':
Example 1Test it NowOutput: Elements in queue : [12, 98, 122, 102, 112] Remaining elements in queue : [12, 98, 112] Example 2Test it NowOutput: Cake Pulses Sugar Salt Basmati Rice Aata New List : [Pulses, Sugar, Basmati Rice, Aata] Example 3Test it NowOutput: Elements in queue : [12, 98, 122, 102, 112]
Next TopicJava ConcurrentLinkedQueue
|