Java LinkedBlockingDeque addLast() method21 Mar 2025 | 2 min read The addLast() method of LinkedBlockingDeque class adds the specified elements at the end of this deque, without exceeding the capacity. Syntax:Parameters:e - this is the element to be added. Specified By:The addLast() method of LinkedBlockingDeque class is specified by :
Throws:The add() method throws: NullPointerException - if the specified element e, is null. IllegalStateException - if this deque is full Example 1Output: [1, 2, 3, 4, 5] After inserting 10 at Last position [1, 2, 3, 4, 5, 10] Example 2Output: 1. Disha 2. Tanmay 3. Prachi 4. Garvit After adding string at last position : 1. Disha 2. Tanmay 3. Prachi 4. Garvit 5. Diya Example 3Output: Exception in thread "main" java.lang.IllegalStateException: Deque full at java.util.concurrent.LinkedBlockingDeque.addFirst(LinkedBlockingDeque.java:326) at com.javaTpoint.LinkedBlockingDequeAddLastExample3.main(LinkedBlockingDequeAddLastExample3.java:12) Example 4Output: Exception in thread "main" java.lang.NullPointerException at java.util.concurrent.LinkedBlockingDeque.offerLast(LinkedBlockingDeque.java:357) at java.util.concurrent.LinkedBlockingDeque.addLast(LinkedBlockingDeque.java:334) at com.javaTpoint.LinkedBlockingDequeAddLastExample4.main(LinkedBlockingDequeAddLastExample4.java:11) dr Next TopicJava Linkedblockingdeque |
Java LinkedBlockingDeque method The method of LinkedBlockingDeque class returns the last element of this deque but does not withdraw it. Syntax: public E Parameters: NA Specified By: The method of LinkedBlockingDeque class is specified by method in interface Deque<E>. Return Value: The method returns the last element of...
1 min read
Java LinkedBlockingDeque method The method of LinkedBlockingDeque class returns an iterator over the elements of this queue. The elements are returned in the reverse sequential order. Syntax: public Iterator<E> Parameters: NA Specified By: The method of LinkedBlockingDeque class is specified by method of interface Deque<E>. Return Value: The ...
3 min read
Java LinkedBlockingDeque Method The method of LinkedBlockingDeque class retrieves the head of the queue corresponding to this deque, but doesn't remove it. The method returns null if this deque is empty. Syntax: public E Parameters: NA Specified By: The method of LinkedBlockingDeque class is specified by: method in...
3 min read
Java LinkedBlockingDeque method The method of LinkedBlockingDeque class is used to add all the elements of the specified collection at the end of this deque. This method overrides in class AbstractQueue<E>. Syntax: public boolean addAll(Collection<? extends E> c Parameters: c- the elements to be added to this...
3 min read
Java LinkedBlockingDeque method The method of LinkedBlockingDeque class returns the first element of this deque but does not withdraw it. Syntax: public E Parameters: NA Specified By: The method of LinkedBlockingDeque class is specified by method in interface Deque<E>. Return Value: The method returns the first element of...
3 min read
Java LinkedBlockingDeque Method The method of LinkedBlockingDeque class retrieves the head of the queue corresponding to this deque, and also removes it. This method returns null if this deque is empty. The poll(long timeout, TimeUnit unit) method of LinkedBlockingDequeclass retrieves the head of the queue...
2 min read
Java LinkedBlockingDeque Method The method of LinkedBlockingDeque class retrieves this deque's last element, but doesn't remove it. The method returns null if this deque is empty. Syntax: public E peekLast () Parameters: NA Specified By: The peekLast () method of LinkedBlockingDeque class is specified by method in interface Deque<E>. Return...
3 min read
Java LinkedBlockingDeque Method The method of LinkedBlockingDeque class retrieves the last element of this deque, and also removes it. This method returns null if this deque is empty. The pollLast(long timeout, TimeUnit unit) method of LinkedBlockingDeque class retrieves the last element of this deque, awaiting...
2 min read
Java LinkedBlockingDeque Method The method of LinkedBlockingDeque class retrieves this deque's first element, but doesn't remove it. The method returns null if this deque is empty. Syntax: public E Parameters: NA Specified By: The method of LinkedBlockingDeque class is specified by method in interface Deque<E>. Return Value: The ...
3 min read
Java LinkedBlockingDeque method The method of LinkedBlockingDeque class returns an iterator across the elements of this deque in the appropriate order. The elements returned will be in the order from head to tail. Syntax: public Iterator<E> Parameters: NA Specified By: The method of LinkedBlockingDeque class is specified by: ...
3 min read
We request you to subscribe our newsletter for upcoming updates.
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