mirror of
https://codeberg.org/JasterV/cool-data-structures.git
synced 2026-04-26 18:40:04 +00:00
little change on hash set
This commit is contained in:
parent
a4447d9baa
commit
deaaf21949
1 changed files with 5 additions and 3 deletions
|
|
@ -43,9 +43,11 @@ impl<T: Hash + PartialEq + Clone> HashSet<T> {
|
||||||
match self.data[index] {
|
match self.data[index] {
|
||||||
Some(ref mut list) => list.push_front(value),
|
Some(ref mut list) => list.push_front(value),
|
||||||
None => {
|
None => {
|
||||||
let mut list = LinkedList::new();
|
self.data[index] = {
|
||||||
list.push_back(value);
|
let mut list = LinkedList::new();
|
||||||
self.data[index] = Some(list)
|
list.push_back(value);
|
||||||
|
Some(list)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
self.size += 1;
|
self.size += 1;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue