class PriorityQueue(T)

Included Modules

Defined in:

priority-queue.cr

Instance Method Summary

Instance Method Detail

def <<(item : T) #
Description copied from class Array(T)

Append. Alias for #push.

a = [1, 2]
a << 3 # => [1,2,3]

[View source]
def push(item : T) #
Description copied from class Array(T)

Append. Pushes one value to the end of self, given that the type of the value is T (which might be a single type or a union of types). This method returns self, so several calls can be chained. See pop for the opposite effect.

a = ["a", "b"]
a.push("c") # => ["a", "b", "c"]
a.push(1)   # Errors, because the array only accepts String.

a = ["a", "b"] of (Int32 | String)
a.push("c") # => ["a", "b", "c"]
a.push(1)   # => ["a", "b", "c", 1]

[View source]
def push(*items : T) #
Description copied from class Array(T)

Append multiple values. The same as #push, but takes an arbitrary number of values to push into self. Returns self.

a = ["a"]
a.push("b", "c") # => ["a", "b", "c"]

[View source]