Java PriorityQueue iterator() MethodThe iterator() method of the PriorityQueue class returns an iterator over the elements in this queue. The elements are not returned in any particular order by the iterator. SyntaxParameterNA Specified ByThe iterator() method of the PrioriryQueue class is specified by:
Return ValueThe iterator() method returns an iterator over the elements in this queue. Example 1Test it NowOutput: Brian Elena Dominic Letty Example 2Test it NowOutput: Ascending order : 200 780 654 1090 Example 3Test it NowOutput: 1 Amit 2 Simran 3 Raj 4 Barun
Next TopicJava PriorityQueue
|