Concurrent::Collection::NonConcurrentPriorityQueue < NonConcurrentPriorityQueueImplementation
| Use Case | Command | Description |
|---|---|---|
| ๐ Create a priority queue | queue = Concurrent::Collection::NonConcurrentPriorityQueue.new | ๐ฏ Creates a new nonโthreadโsafe priority queue (default order: highest first) |
| โ Add an element | queue.push(element) | ๐ฅ Inserts an element at the correct position based on priority |
| โฌ๏ธ Remove highest priority element | element = queue.pop | ๐๏ธ Removes and returns the element with the highest priority |
| ๐๏ธ Peek at highest priority | queue.peek | ๐ Returns the highest priority element without removing it |
| โ Check if empty | queue.empty? | โ
Returns true if the queue has no elements |
| ๐ Get size | queue.length | ๐ข Returns the number of elements in the queue |
| ๐งน Clear the queue | queue.clear | ๐ฎ Removes all elements |
๐ฏ A queue collection in which the elements are sorted based on their comparison (spaceship) operator <=>. Items are added to the queue at a position relative to their priority. On removal the element with the "highest" priority is removed. By default the sort order is from highest to lowest, but a lowestโtoโhighest sort order can be set on construction.
๐ The API is based on the Queue class from the Ruby standard library.
โ๏ธ The pure Ruby implementation, RubyNonConcurrentPriorityQueue uses a heap algorithm stored in an array. The algorithm is based on the work of Robert Sedgewick and Kevin Wayne.
โ The JRuby native implementation is a thin wrapper around the standard library java.util.NonConcurrentPriorityQueue.
๐ When running under JRuby the class NonConcurrentPriorityQueue extends JavaNonConcurrentPriorityQueue. When running under all other interpreters it extends RubyNonConcurrentPriorityQueue.
โ ๏ธ Note: This implementation is not thread safe.
Generated by phpman v4.9.26-1-g511901d · Markdown · JSON · MCP Author: Che Dong Under GNU General Public License
2026-07-29 18:42 @216.73.216.177
CrawledBy Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)
Enhanced by LLM: deepseek-v4-flash / taotoken.net / www.chedong.com - original format