class

CrystalMoji::Util::PriorityQueue(T)

Inherits Enumerable < Reference < Object

最小堆实现的PriorityQueue

Constructors

new(compare_fn : Proc(T, T, Bool))
Source

Instance methods

each

Must yield this collection's elements to the block.

Source
empty?

Returns true if self does not contain any element.

([] of Int32).empty? # => true
([1]).empty?         # => false
[nil, false].empty?  # => false
  • #present? returns the inverse.
Source
peek
Source
push(value : T)
Source
size

Returns the number of elements in the collection.

[1, 2, 3, 4].size # => 4
Source