VOOZH about

URL: https://www.geeksforgeeks.org/java/blockingdeque-iterator-method-in-java-with-examples/

⇱ BlockingDeque iterator() method in Java with examples - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

BlockingDeque iterator() method in Java with examples

Last Updated : 12 Jul, 2025
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. Syntax:
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: Program 1:
Output:
The iterator values of BlockingDeque are:
74381793
5278367
35658786
7855642
Program 2:
Output:
The iterator values of BlockingDeque are:
Geeks
forGeeks
A
Computer
Portal
Reference: https://docs.oracle.com/javase/7/docs/api/java/util/concurrent/BlockingDeque.html#iterator()
Comment