[ 
https://issues.apache.org/jira/browse/GROOVY-11650?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17949466#comment-17949466
 ] 

Eric Milles edited comment on GROOVY-11650 at 5/5/25 3:07 PM:
--------------------------------------------------------------

Yes, iterator() use poll() to fix the order issue you discuss at the top.


was (Author: emilles):
Yes, iterator() uses poll() to fix the order issue you discuss at the top.

> Create drain extension method for Queues
> ----------------------------------------
>
>                 Key: GROOVY-11650
>                 URL: https://issues.apache.org/jira/browse/GROOVY-11650
>             Project: Groovy
>          Issue Type: New Feature
>            Reporter: Paul King
>            Assignee: Paul King
>            Priority: Major
>             Fix For: 5.x
>
>
> The standard iterator for queues like PriorityQueue don't iterate according 
> to priority order. You have to use poll (or drainTo for blocking queues) to 
> get the elements in priority order. It would be useful to have a "drain()" or 
> "elements()" method to get a list of all the elements that successive calls 
> to poll would return. The intention would be that the queue was drained upon 
> completion of the call.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to