ArrayDeque iterator() Method in Java
The Java.util.ArrayDeque.iterator() method is used to return an iterator of the elements of the ArrayDeque.
Iterator iterate_value = Array_Deque.iterator();
Parameters: The method does not take any parameter.
Return Value: The method iterates over the elements of the deque and returns the values(iterator).
Below programs illustrate the Java.util.ArrayDeque.iterator() method:
ArrayDeque: [Welcome, To, Geeks, 4, Geeks] The iterator values are: Welcome To Geeks 4 Geeks
ArrayDeque: [10, 15, 30, 20, 5] The iterator values are: 10 15 30 20 5
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.