(key string)
| 51 | } |
| 52 | |
| 53 | func (table *HashTable) Remove(key string) bool { |
| 54 | position := generateHash(key) |
| 55 | if table.data[position] == nil { |
| 56 | return false |
| 57 | } |
| 58 | if table.data[position].key == key { |
| 59 | table.data[position] = table.data[position].next |
| 60 | return true |
| 61 | } |
| 62 | current := table.data[position] |
| 63 | for current.next != nil { |
| 64 | if current.next.key == key { |
| 65 | current.next = current.next.next |
| 66 | return true |
| 67 | } |
| 68 | current = current.next |
| 69 | } |
| 70 | return false |
| 71 | } |
| 72 | |
| 73 | func generateHash(s string) uint8 { |
| 74 | hash := fnv.New32a() |
nothing calls this directly
no test coverage detected