diff --git a/mysort/common.go b/mysort/common.go index 6e818d7..c86ac95 100644 --- a/mysort/common.go +++ b/mysort/common.go @@ -5,10 +5,8 @@ type base struct { items []interface{} } -func (b *base) Add(args ...interface{}) { - for _, v := range args { - b.items = append(b.items, v) - } +func (b *base) Add(item interface{}) { + b.items = append(b.items, item) } // EqualAt 获取相等位置下标,不重复返回-1 @@ -23,7 +21,7 @@ func (b *base) EqualAt(item interface{}) int { } // GetItems 获取 -func (b *base) GetItems() []interface{} { +func (b *base) GetItems() interface{} { return b.items } diff --git a/mysort/simple_fifo.go b/mysort/simple_fifo.go index d065467..547ffd2 100644 --- a/mysort/simple_fifo.go +++ b/mysort/simple_fifo.go @@ -27,5 +27,5 @@ func (f *Fifo) PushGrab(item interface{}) { // Gets 获取 func (f *Fifo) Gets() []interface{} { - return f.GetItems() + return f.items } diff --git a/mysort/simple_lifo.go b/mysort/simple_lifo.go index a5ea726..9fb2f2b 100644 --- a/mysort/simple_lifo.go +++ b/mysort/simple_lifo.go @@ -27,5 +27,5 @@ func (f *Lifo) PushGrab(item interface{}) { // Gets 获取 func (f *Lifo) Gets() []interface{} { - return f.GetItems() + return f.items }