LinkedBlockingDeque iterator() method in Java
The iterator() method of LinkedBlockingDeque returns an iterator over the elements in this deque in a proper sequence. The elements will be returned in order from first (head) to last (tail). The returned iterator is a “weakly consistent” iterator.
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.
public Iterator iterator()
Parameters: This method does not accept any parameter.
Returns: This method returns an iterator over the elements in this deque in a proper sequence.
Below programs illustrate iterator() method of LinkedBlockingDeque:
The iterator values of LinkedBlockingDeque are: 74381793 5278367 35658786 7855642
The iterator values of LinkedBlockingDeque are: Geeks forGeeks A Computer Portal