github.com/whatap/golib@v0.0.22/util/hmap/StringIntLinkedEntry.go (about) 1 package hmap 2 3 import ( 4 "fmt" 5 6 "github.com/whatap/golib/util/hash" 7 ) 8 9 type StringIntLinkedEntry struct { 10 key string 11 keyHash uint 12 value int32 13 hash_next *StringIntLinkedEntry 14 link_next *StringIntLinkedEntry 15 link_prev *StringIntLinkedEntry 16 } 17 18 func (this *StringIntLinkedEntry) GetKey() string { 19 return this.key 20 } 21 func (this *StringIntLinkedEntry) GetValue() int32 { 22 return this.value 23 } 24 func (this *StringIntLinkedEntry) SetValue(v int32) int32 { 25 old := this.value 26 this.value = v 27 return old 28 } 29 func (this *StringIntLinkedEntry) Equals(o *StringIntLinkedEntry) bool { 30 return this.key == o.key 31 } 32 33 func (this *StringIntLinkedEntry) HashCode() uint { 34 return uint(hash.Hash([]byte(this.key))) 35 } 36 37 func (this *StringIntLinkedEntry) ToString() string { 38 return fmt.Sprintf("%s=%v", this.key, this.value) 39 }