class Priority::NamedQueue(V)
- Priority::NamedQueue(V)
- Priority::Queue(V)
- Array(Priority::Item(V))
- Reference
- Object
Defined in:
priority-queue/named_queue.crInstance Method Summary
- #named_items
- 
        #pop(n : Int)
        
          Removes the last n values from self, at index size - 1.
- 
        #pop
        
          Removes the last value from self, at index size - 1.
- #push(item : Item(V))
- 
        #shift(n : Int)
        
          Removes the first n values of self, starting at index 0.
- 
        #shift
        
          Removes the first value of self, at index 0.
Instance methods inherited from class Priority::Queue(V)
  
  
    
      <<(item : Item(V))
    <<, 
    
  
    
      push(priority : Int32, value : V, name = nil)push(item : Item(V))
push(*items : Item(V)) push
Instance Method Detail
Removes the last n values from self, at index size - 1.
This method returns an array of the removed values, with the original order preserved.
If n is greater than the size of self, all values will be removed from self
without raising an error.
a = ["a", "b", "c"]
a.pop(2) # => ["b", "c"]
a        # => ["a"]
a = ["a", "b", "c"]
a.pop(4) # => ["a", "b", "c"]
a        # => []See also: #truncate.
Removes the last value from self, at index size - 1.
This method returns the removed value.
Raises IndexError if array is of 0 size.
a = ["a", "b", "c"]
a.pop # => "c"
a     # => ["a", "b"]See also: #truncate.
Removes the first n values of self, starting at index 0.
This method returns an array of the removed values.
If n is greater than the size of self, all values will be removed from self
without raising an error.
a = ["a", "b", "c"]
a.shift # => "a"
a       # => ["b", "c"]
a = ["a", "b", "c"]
a.shift(4) # => ["a", "b", "c"]
a          # => []See also: #truncate.
Removes the first value of self, at index 0. This method returns the removed value.
If the array is empty, it raises IndexError.
a = ["a", "b", "c"]
a.shift # => "a"
a       # => ["b", "c"]See also: #truncate.