TreeMap::max_key
pub fn max_key(K fallback) -> K Import
Source: use collections::tree::{TreeMap}; src/collections/tree.hy Returns the largest key, or fallback when the map is empty.
Called on a TreeMap value as value.max_key(…).
Parameters#
| Name | Type |
|---|---|
fallback | K |
Returns#
K
Examples#
use collections::tree::{TreeMap};
use tests::assert;
let m: TreeMap<int, bool> = TreeMap::new();
m.insert(4, true);
m.insert(9, true);
assert!(m.max_key(-1) == 9);
See also#
TreeMap: An ordered map from keys of typeKto values of typeV.TreeMap::new: Creates an empty map.TreeMap::empty: Creates an empty map; the same asTreeMap::new.TreeMap::size: Returns the number of entries.TreeMap::is_empty: Returnstruewhen the map has no entries.TreeMap::clear: Removes every entry.TreeMap::iter: Returns an iterator over the entries in ascending key order.TreeMap::insert: Storesvunderk, replacing any value already there.