Method: Puppet::Graph::RbTreeMap#delete_max

Defined in:
lib/puppet/graph/rb_tree_map.rb

#delete_maxObject

Deletes the item with the largest key and returns the item. Returns nil if key is not present.

Complexity: O(log n)

map = Containers::TreeMap.new
map.push("MA", "Massachusetts")
map.push("GA", "Georgia")
map.delete_max #=> "Georgia"
map.size #=> 1


170
171
172
173
174
175
176
177
178
# File 'lib/puppet/graph/rb_tree_map.rb', line 170

def delete_max
  result = nil
  if @root
    @root, result = delete_max_recursive(@root)
    @root.color = :black if @root
    @size -= 1
  end
  result
end