Java Deque descendingIterator() Method22 Mar 2025 | 2 min read The descendingIterator() method of Java Deque Interface returns an iterator for the elements in the specified deque in a reverse sequence. The elements will return in a sequential order from first(head) to the last(tail). Syntax:Parameter:NA Return:The above method returns an iterator for the elements in the specified deque in a reverse sequence. Example 1Output: The list of numbers before using descendingIterator : 32 21 20 17 89 The list of numbers after using descendingIterator : 89 17 20 21 32 Example 2Output: The list of numbers before using descendingIterator : 20.0 11.0 66.0 89.0 77.0 The list of numbers after using descendingIterator : 77.0 89.0 66.0 11.0 20.0 Next TopicJava Deque |
Java Deque Method The method of Deque interface is used to remove the first occurrence of the given element from the deque. If there is no element in the deque, then it remains unchanged. It may return true if the deque contains the specified...
2 min read
Java Deque Method The method of Deque interface is used to remove the last occurrence of the specified element from the given deque. If there is no element in the deque, then it remains unchanged. The above method returns true if the specified element...
2 min read
Java Deque Method The method of Java Deque Interface returns true if the deque contains the specified element. Specified by: contains in interface Collection<E> Syntax: boolean contains(Object o) Parameter: The above method consists of only one parameter: a.) The element 'o' which is already present in the deque and is tested. Return: The...
2 min read
Java Deque Method The method of Java Deque Interface retrieves but not remove the last element of the deque. The above method differs from the peekLast only in one way that it throws an exception only if the deque is empty. Syntax: public E Parameter: N.A. Return: The above...
2 min read
Java Deque Method The method of Deque interface is used to return the total number of elements present in the given deque. Syntax: int Parameter: The above method requires only one parameter: The element 'o' that needs to be removed. Specified by: size in interface Collection<E> Return: The above method is used...
2 min read
Java Deque Method The method of Java Deque Interface retrieves but not remove the head of the queue which is represented by the deque. The above method differs from the peek only in one way that it throws an exception only if the deque...
1 min read
Java Deque Method The method of Java Deque Interface inserts the given element into the queue which is represented by the particular deque. Specified by: offer in interface Queue<E> Syntax: boolean offer(E e) Parameter: The above method requires only one parameter : The element 'e' that needs to be...
2 min read
Java Deque Method The method of Java Deque Interface is used to insert the specified element at the front of the deque . Syntax: void addFirst(E e) Parameter: The above method consists of only one parameter: The element 'e' that needs to be added. Return: NA Throw: IllegalStateException- If the elements...
2 min read
Java Deque Method The method of Deque interface is used to insert the specified element into the specified queue represented by the deque and returns true upon success and throws an IllegalStateException if there is no current space available. Specified by: add in interface Collection<E> add in...
2 min read
Java Deque Method The method of Java Deque interface is used to retrieve and removes the last element of the given deque. The above method is different from the pollLast() method such that it throws an exception if the given deque is empty. Syntax: public E...
2 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