github.com/whatap/golib@v0.0.22/util/hmap/IntSetry.go (about) 1 package hmap 2 3 import ( 4 //"fmt" 5 "strconv" 6 ) 7 8 type IntSetry struct { 9 key int32 10 next *IntSetry 11 } 12 13 func NewIntSetry(key int32, next *IntSetry) *IntSetry { 14 p := new(IntSetry) 15 p.key = key 16 p.next = next 17 return p 18 } 19 func (this *IntSetry) Clone() *IntSetry { 20 var n *IntSetry 21 if this.next == nil { 22 n = nil 23 } else { 24 n = this.next.Clone() 25 } 26 return NewIntSetry(this.key, n) 27 } 28 29 func (this *IntSetry) GetKey() int32 { 30 return this.key 31 } 32 33 func (this *IntSetry) Get() int32 { 34 return this.key 35 } 36 37 //func (this *IntSetry) Equals(o interface{}) bool{ 38 // var e *IntSetry 39 // switch o.(type){ 40 // case IntSetry: 41 // e = o.(*IntSetry) 42 // default: 43 // return false 44 // } 45 // if e.GetKey() == this.key { 46 // return true 47 // }else { 48 // return false 49 // } 50 //} 51 52 func (this *IntSetry) Equals(o *IntSetry) bool { 53 return this.key == o.key 54 } 55 56 func (this *IntSetry) HashCode() int32 { 57 return this.key 58 } 59 60 func (this *IntSetry) ToString() string { 61 return strconv.Itoa(int(this.key)) 62 }