May 2019
Intermediate to advanced
698 pages
17h 21m
English
Looking up entries is part of the insert process of HashMap and it relies on the same functions to provide a suitable entry instance to add data. Just like the insertion process, the lookup process does almost the same, save some steps in the end, listed as follows:
Since all of this has already been implemented for use in other functions, get() is pretty short, shown in the following code:
pub fn get<Q: ?Sized>(&self, k: &Q) -> Option<&V> where K: Borrow<Q>, Q: Hash + Eq{ self.search(k).map(|bucket| bucket.into_refs().1)}
Similarly, the remove function requires search, and removal is implemented on the ...
Read now
Unlock full access