[
https://issues.apache.org/jira/browse/GROOVY-11650?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17949354#comment-17949354
]
Paul King commented on GROOVY-11650:
------------------------------------
{quote}If you create an iterator extension method, could you step in front? The
iterator is used for for loop and spread.{quote}
[~emilles] I wasn't sure what you meant. Did you mean make a breaking change
and change iterator() to use poll()?
> 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)