Java LinkedTransferQueue remove() method

The remove() method of Java LinkedTransferQueue class is used to remove the specified element from the queue if that element is present in the queue. This method of LinkedTransferQueue class overrides the remove in class AbstractCollection.

Syntax:

Parameters:

The parameter 'o' is the element to be removed from the queue if it is present.

Specified By:

The remove () method of LinkedTransferQueue class is specified by:

  • remove in interface Collection.
  • remove in interface BlockingQueue.

Return:

This method returns a Boolean value true if this queue changed as a result of the call.

Example 1

Test it Now

Output:

Elements in queue : [38, 24, 202, 290, 19]
Remaining elements in queue : [38, 24, 202, 290, 19]

Example 2

Test it Now

Output:

Cake
Candle
Knife
Matchbox
Cap
Stricker
New List : [Candle, Knife, Cap, Stricker]

Example 3

Test it Now

Output:

Elements in queue : [27, 49, 190, 72, 42]





Latest Courses