Java LinkedBlockingDeque offerLast() MethodThe offerLast() method of LinkedBlockingDeque class adds the defined elements at the end of this deque, only if the deque's capacity allows so. 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 offerLast() method of LinkedBlockingDeque class is specified by:
Return Value:The offerLast() method returns true if the defined element is added to this deque, else returns false. Throws:The offerLast() method throws:
Example 1Test it NowOutput: [15, 16, 17, 18, 19, 20] After inserting 21 at Last position [15, 16, 17, 18, 19, 20, 21] Example 2Test it NowOutput: 1. Kapil 2. Payal 3. Diksha 4. Nishank After adding string at last position : 1. Kapil 2. Payal 3. Diksha 4. Nishank 5. Manav 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