class PriorityQueue(T)
- PriorityQueue(T)
- Array(T)
- Reference
- Object
Included Modules
- Bisect::Helper
Defined in:
priority-queue.crInstance Method Summary
-
#<<(item : T)
Append.
-
#push(item : T)
Append.
-
#push(*items : T)
Append multiple values.
Instance Method Detail
def <<(item : T)
#
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]