The Java.util.ArrayDeque.clear() method in Java is used to remove all of the elements from the Deque. Using the clear() method only clears all the element from the deque and does not delete the deque. In other words, it can be said that the clear() method is used to only empty an existing ArrayDeque.
Parameters: The method does not take any parameter.
Return Value: The function does not return any value.
Below programs illustrate the Java.util.ArrayDeque.clear() method:
ArrayDeque: [Welcome, To, Geeks, 4, Geeks] ArrayDeque: 
ArrayDeque: [10, 15, 30, 20, 5] ArrayDeque: 
Attention reader! Don’t stop learning now. Get hold of all the important Java Foundation and Collections concepts with the Fundamentals of Java and Java Collections Course at a student-friendly price and become industry ready. To complete your preparation from learning a language to DS Algo and many more, please refer Complete Interview Preparation Course.