(key int, value int)
| 30 | } |
| 31 | |
| 32 | func (this *MyHashMap) Put(key int, value int) { |
| 33 | cur := this.Array[this.hash(key)] |
| 34 | for cur.Next != nil { |
| 35 | if cur.Next.Key == key { |
| 36 | cur.Next.Val = value |
| 37 | return |
| 38 | } |
| 39 | cur = cur.Next |
| 40 | } |
| 41 | cur.Next = NewNode(key, value) |
| 42 | } |
| 43 | |
| 44 | func (this *MyHashMap) Get(key int) int { |
| 45 | cur := this.Array[this.hash(key)] |