Documentation
¶
Index ¶
- type Int8s
- func (s *Int8s) Append(data ...int8)
- func (s Int8s) Cap() int
- func (s Int8s) Copy() Int8s
- func (s *Int8s) Insert(index int, data ...int8)
- func (s Int8s) Len() int
- func (s Int8s) Less(i, j int) bool
- func (s *Int8s) Prepend(data ...int8)
- func (s *Int8s) Remove(index, num int) int
- func (s Int8s) ReverseSort() Int8s
- func (s Int8s) Shuffle() Int8s
- func (s Int8s) Sort() Int8s
- func (s Int8s) Swap(i, j int)
- type Int16s
- func (s *Int16s) Append(data ...int16)
- func (s Int16s) Cap() int
- func (s Int16s) Copy() Int16s
- func (s *Int16s) Insert(index int, data ...int16)
- func (s Int16s) Len() int
- func (s Int16s) Less(i, j int) bool
- func (s *Int16s) Prepend(data ...int16)
- func (s *Int16s) Remove(index, num int) int
- func (s Int16s) ReverseSort() Int16s
- func (s Int16s) Shuffle() Int16s
- func (s Int16s) Sort() Int16s
- func (s Int16s) Swap(i, j int)
- type Int32s
- func (s *Int32s) Append(data ...int32)
- func (s Int32s) Cap() int
- func (s Int32s) Copy() Int32s
- func (s *Int32s) Insert(index int, data ...int32)
- func (s Int32s) Len() int
- func (s Int32s) Less(i, j int) bool
- func (s *Int32s) Prepend(data ...int32)
- func (s *Int32s) Remove(index, num int) int
- func (s Int32s) ReverseSort() Int32s
- func (s Int32s) Shuffle() Int32s
- func (s Int32s) Sort() Int32s
- func (s Int32s) Swap(i, j int)
- type Int64s
- func (s *Int64s) Append(data ...int64)
- func (s Int64s) Cap() int
- func (s Int64s) Copy() Int64s
- func (s *Int64s) Insert(index int, data ...int64)
- func (s Int64s) Len() int
- func (s Int64s) Less(i, j int) bool
- func (s *Int64s) Prepend(data ...int64)
- func (s *Int64s) Remove(index, num int) int
- func (s Int64s) ReverseSort() Int64s
- func (s Int64s) Shuffle() Int64s
- func (s Int64s) Sort() Int64s
- func (s Int64s) Swap(i, j int)
- type Ints
- func (s *Ints) Append(data ...int)
- func (s Ints) Cap() int
- func (s Ints) Copy() Ints
- func (s *Ints) Insert(index int, data ...int)
- func (s Ints) Len() int
- func (s Ints) Less(i, j int) bool
- func (s *Ints) Prepend(data ...int)
- func (s *Ints) Remove(index, num int) int
- func (s Ints) ReverseSort() Ints
- func (s Ints) Shuffle() Ints
- func (s Ints) Sort() Ints
- func (s Ints) Swap(i, j int)
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Int16s ¶
type Int16s []int16
Int16s 定义方便操作[]int16的类型
func (Int16s) ReverseSort ¶
type Int32s ¶
type Int32s []int32
Int32s 定义方便操作[]int32的类型
func (Int32s) ReverseSort ¶
type Int64s ¶
type Int64s []int64
Int64s 定义方便操作[]int64的类型
func (Int64s) ReverseSort ¶
type Ints ¶
type Ints []int
Ints 定义方便操作[]int的类型
Example ¶
package main
import (
"fmt"
"github.com/recallsong/go-utils/container/slice/ints"
)
func main() {
s := ints.Ints{}
s.Append(1, 2)
s.Prepend(-4, -3, -2, -1, 0)
s.Insert(1, 3, 4, 5, 6)
fmt.Println(s, s.Len())
s1 := s.Copy()
removed := s1.Remove(3, 6)
fmt.Println(s1, s1.Len(), removed)
}
Output: [-4 3 4 5 6 -3 -2 -1 0 1 2] 11 [-4 3 4 1 2] 5 6
Example (Order) ¶
package main
import (
"fmt"
"github.com/recallsong/go-utils/container/slice/ints"
)
func main() {
s := ints.Ints{}
s.Append(9, 1, 8, 2, 7, 3, 6, 4, 5)
s.Sort()
fmt.Println(s)
s.ReverseSort()
fmt.Println(s)
s.Shuffle() //随机打乱数据
// fmt.Println(s)
}
Output: [1 2 3 4 5 6 7 8 9] [9 8 7 6 5 4 3 2 1]
func (Ints) ReverseSort ¶
Click to show internal directories.
Click to hide internal directories.