Method: Containers::RubyRBTreeMap#max_key
- Defined in:
- lib/containers/rb_tree_map.rb
#max_key ⇒ Object
Return the largest key in the map.
Complexity: O(log n)
map = Containers::TreeMap.new
map.push("MA", "Massachusetts")
map.push("GA", "Georgia")
map.max_key #=> "MA"
114 115 116 |
# File 'lib/containers/rb_tree_map.rb', line 114 def max_key @root.nil? ? nil : max_recursive(@root) end |