Java ConcurrentLinkedQueue offer() MethodThe offer() method of ConcurrentLinkedQueue class is used to add the specified element at the tail of this queue. Syntax:Parameters:The parameter 'e' is the element that is to be added in the queue. Specified By:The offer() method of ConcurrentLinkedQueue class is specified by: offer in the interface Queue<E>. 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 1Test it NowOutput: Queue : [12, 67, 45, 123] Example 2Test it NowOutput: Reema Rahul Rita Ramesh Gita Example 3Test it NowOutput: Reema Panda [email protected] Geetanjali Sharma [email protected] Vineet Tanjea [email protected] Himanshu Bhardwaj [email protected]
Next TopicJava ConcurrentLinkedQueue
|