| Author |
Why Iterator doesn't iterators according to elements priority ?
|
Parthiban Malayandi
Ranch Hand
Joined: Apr 15, 2008
Posts: 69
|
|
Hi all, I have a question in PriorityQueue collection. Here's the program I tried to understand it Output : ======== I learned that using a no-arg constructor of PriorityQueue uses the comparator to order it's elements according to it's natural ordering. I can see this when I invoke poll() method on it but why I use Iterator to iterate its elements it's not iterating in that order (not even in the order when I inserted ) . Can any one tell me on what basis Iterator iterates the element ? Thanks in advance [ October 18, 2008: Message edited by: Parthiban Mahiby ]
|
 |
Ankit Garg
Saloon Keeper
Joined: Aug 03, 2008
Posts: 9191
|
|
|
see this...
|
SCJP 6 | SCWCD 5 | Javaranch SCJP FAQ | SCWCD Links
|
 |
Parthiban Malayandi
Ranch Hand
Joined: Apr 15, 2008
Posts: 69
|
|
Hi Ankit, Thanks for your reply.got it.
|
 |
 |
|
|
subject: Why Iterator doesn't iterators according to elements priority ?
|
|
|