| ... | @@ -76,6 +76,9 @@ pub fn HashMap(inline K: type, inline V: type, inline hash: fn(key: K)->u32, | ... | @@ -76,6 +76,9 @@ pub fn HashMap(inline K: type, inline V: type, inline hash: fn(key: K)->u32, |
| 76 | } | 76 | } |
| 77 | | 77 | |
| 78 | pub fn put(hm: &Self, key: K, value: V) -> %void { | 78 | pub fn put(hm: &Self, key: K, value: V) -> %void { |
| | 79 | if (hm.entries.len == 0) { |
| | 80 | %return hm.initCapacity(16); |
| | 81 | } |
| 79 | hm.incrementModificationCount(); | 82 | hm.incrementModificationCount(); |
| 80 | | 83 | |
| 81 | // if we get too full (60%), double the capacity | 84 | // if we get too full (60%), double the capacity |