[ https://issues.apache.org/jira/browse/GROOVY-11650?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17949586#comment-17949586 ]
Paul King commented on GROOVY-11650: ------------------------------------ The iterator ordering is known behaviour for various queue classes and is mentioned in their Javadocs. I think it is cleaner to have a new method, otherwise Java code and Groovy code will behave differently and some folks might be relying on that behaviour, and might request a method to get the old behaviour back. I was more trying to make it convenient to use queues in their current form than to try to fix the arguably slightly klunky design. > 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)