Java LinkedBlockingDeque offer() MethodThe offer() method of LinkedBlockingDeque class adds the defined element at the tail of this deque. Syntax:Parameters:e - It is the element to be added. timeout - It is the time till the method has to wait before giving up, in units of unit. unit - It is the TimeUnit that decides how to interpret the timeout parameter. Specified By:The offer() method of LinkedBlockingDeque class is specified by:
Return Value:The offer() method returns true if the defined element is added to this queue, else returns false. Throws:The offer() method throws:
Example 1Test it NowOutput: Queue before using offer() : [567, 56, 5671, 5167] Queue after using offer() : [567, 56, 5671, 5167, 5670] Example 2Test it NowOutput: Albert Christeena Aviral Pratik Janak Example 3Test it NowOutput: Harshit Bhardwaj 15023022 Rahul Verma 15023045 Deepanjali Thakur 15023015 Raman Mehta 14022056 Next TopicJava Linkedblockingdeque |
We provides tutorials and interview questions of all technology like java tutorial, android, java frameworks
G-13, 2nd Floor, Sec-3, Noida, UP, 201301, India