diff --git a/src/libextra/smallintmap.rs b/src/libextra/smallintmap.rs index 8b8e3faaf9a..c1cf89c36ab 100644 --- a/src/libextra/smallintmap.rs +++ b/src/libextra/smallintmap.rs @@ -46,11 +46,6 @@ impl Mutable for SmallIntMap { } impl Map for SmallIntMap { - /// Return true if the map contains a value for the specified key - fn contains_key(&self, key: &uint) -> bool { - self.find(key).is_some() - } - /// Return a reference to the value corresponding to the key fn find<'a>(&'a self, key: &uint) -> Option<&'a V> { if *key < self.v.len() { diff --git a/src/libextra/treemap.rs b/src/libextra/treemap.rs index 82c7bf6caf1..094bf0e3d83 100644 --- a/src/libextra/treemap.rs +++ b/src/libextra/treemap.rs @@ -105,11 +105,6 @@ impl Mutable for TreeMap { } impl Map for TreeMap { - /// Return true if the map contains a value for the specified key - fn contains_key(&self, key: &K) -> bool { - self.find(key).is_some() - } - /// Return a reference to the value corresponding to the key fn find<'a>(&'a self, key: &K) -> Option<&'a V> { let mut current: &'a Option<~TreeNode> = &self.root; diff --git a/src/libstd/container.rs b/src/libstd/container.rs index 10f3fc6586f..22525d4cab4 100644 --- a/src/libstd/container.rs +++ b/src/libstd/container.rs @@ -34,11 +34,13 @@ pub trait Mutable: Container { /// A map is a key-value store where values may be looked up by their keys. This /// trait provides basic operations to operate on these stores. pub trait Map: Container { - /// Return true if the map contains a value for the specified key - fn contains_key(&self, key: &K) -> bool; - /// Return a reference to the value corresponding to the key fn find<'a>(&'a self, key: &K) -> Option<&'a V>; + + /// Return true if the map contains a value for the specified key + fn contains_key(&self, key: &K) -> bool { + self.find(key).is_some() + } } /// This trait provides basic operations to modify the contents of a map. diff --git a/src/libstd/hashmap.rs b/src/libstd/hashmap.rs index 4de5d316fc0..74cff989c45 100644 --- a/src/libstd/hashmap.rs +++ b/src/libstd/hashmap.rs @@ -272,14 +272,6 @@ impl Mutable for HashMap { } impl Map for HashMap { - /// Return true if the map contains a value for the specified key - fn contains_key(&self, k: &K) -> bool { - match self.bucket_for_key(k) { - FoundEntry(_) => {true} - TableFull | FoundHole(_) => {false} - } - } - /// Return a reference to the value corresponding to the key fn find<'a>(&'a self, k: &K) -> Option<&'a V> { match self.bucket_for_key(k) { diff --git a/src/libstd/trie.rs b/src/libstd/trie.rs index 9bcf430ff90..e523c7cbb14 100644 --- a/src/libstd/trie.rs +++ b/src/libstd/trie.rs @@ -48,12 +48,6 @@ impl Mutable for TrieMap { } impl Map for TrieMap { - /// Return true if the map contains a value for the specified key - #[inline] - fn contains_key(&self, key: &uint) -> bool { - self.find(key).is_some() - } - /// Return a reference to the value corresponding to the key #[inline] fn find<'a>(&'a self, key: &uint) -> Option<&'a T> {