TreeMap::get
pub fn get(K k) -> Option<V> Import
Source: use collections::tree::{TreeMap}; src/collections/tree.hy Returns the value stored under k, or None when there is none.
Called on a TreeMap value as value.get(…).
Parameters#
| Name | Type |
|---|---|
k | K |
Returns#
Option<V>
Examples#
use collections::tree::{TreeMap};
use tests::assert;
let m: TreeMap<string, int> = TreeMap::new();
m.insert("a", 1);
assert!((m.get("a") ?? 0) == 1);
assert!(m.get("b").is_none());
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.