BlockingDeque iterator() method in Java with examples
The iterator() method of BlockingDeque 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.
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.
Note: The iterator() method of BlockingDeque has been inherited from the LinkedBlockingDeque class in Java.
Below programs illustrate iterator() method of BlockingDeque:
The iterator values of BlockingDeque are: 74381793 5278367 35658786 7855642
The iterator values of BlockingDeque are: Geeks forGeeks A Computer Portal
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.