Javatpoint Logo
Javatpoint Logo

Java LinkedTransferQueue offer() method

The offer() method of LinkedTransferQueue class is used to add the specified element at the tail of this LinkedTransferQueue. As the queue is unbounded, this method will never return false.

Syntax:

Specified By:

The isEmpty() method of LinkedTransferQueue class is specified by offer in interface BlockingQueue or by offer in interface Queue.

Throws:

The offer() method throws NullPointerException - if the defined element(e) holds null value.

Return Value:

The offer() method returns true on the successful insertion, otherwise returns false.

Example 1

Test it Now

Output:

Queue : [34, 23, 64, 294]

Example 2

Test it Now

Output:

John
Harry
Kristan
Jack
Marry






Youtube For Videos Join Our Youtube Channel: Join Now

Feedback


Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Preparation


Trending Technologies


B.Tech / MCA