GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing www.geeksforgeeks.org — ArrayBlockingQueue iterator() Method in Java - GeeksforGeeks ArrayBlockingQueue iterator() Method in JavaLast Updated : 11 Jul, 2025 The iterator() method of ArrayBlockingQueue class is used to returns an iterator of the same elements as this queue in a proper sequence. The elements returned from this method contains elements in order from first(head) to last(tail). The returned iterator is weakly consistent.
Syntax:
public Iterator iterator()Return Value: The method returns the iterator having same elements as present in ArrayBlockingQueue in proper sequence. Below programs illustrates iterator() method of ArrayBlockingQueue class: Program 1:
Output:
Program 2:
Queue is [423, 422, 421, 420, 424] The iterator values: 423 422 421 420 424
Output:
Reference: https://docs.oracle.com/javase/8/docs/api/java/util/concurrent/ArrayBlockingQueue.html#iteratorQueue is [User, Employee, Manager, Analyst, HR] The iterator values: User Employee Manager Analyst HR Comment Explore |
| You are visitor 01402503 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |