Add a contains_key method to SparseMap.

This commit is contained in:
Jakob Stoklund Olesen
2017-02-14 15:55:47 -08:00
parent 96e0a3273c
commit 408dc4e72e

View File

@@ -126,6 +126,11 @@ impl<K, V> SparseMap<K, V>
None
}
/// Return `true` if the map contains a value corresponding to `key`.
pub fn contains_key(&self, key: K) -> bool {
self.get(key).is_some()
}
/// Insert a value into the map.
///
/// If the map did not have this key present, `None` is returned.