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 — PriorityQueue iterator() Method in Java - GeeksforGeeks PriorityQueue iterator() Method in JavaLast Updated : 10 Dec, 2018 The Java.util.PriorityQueue.iterator() method is used to return an iterator of the same elements as the Priority Queue. The elements are returned in random order from what present in the Queue.
Syntax:
Iterator iterate_value = Priority_Queue.iterator();Parameters: The function does not take any parameter. Return Value: The method iterates over the elements of the queue and returns the values(iterators). Below programs illustrate the Java.util.PriorityQueue.iterator() method: Program 1:
Output:
Program 2:
PriorityQueue: [4, Geeks, To, Welcome, Geeks] The iterator values are: 4 Geeks To Welcome Geeks
Output:
PriorityQueue: [5, 10, 30, 20, 15] The iterator values are: 5 10 30 20 15 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. |