package
Version:
v0.0.7
Opens a new window with list of versions in this module.
Published: Jul 5, 2023
License: MIT
Opens a new window with license information.
Imports: 1
Opens a new window with list of imports.
Imported by: 0
Opens a new window with list of known importers.
Documentation
¶
-
func Copy[V any](slice []V) []V
-
func CopyMatrix[V any](slice [][]V) [][]V
-
func Del[V any](slice *[]V, index int)
-
func Insert[V any](slice *[]V, index int, value V)
-
func Move[V any](slice *[]V, index, to int)
-
func NextLoop[V any](slice []V, i int) (next int, value V)
-
func PrevLoop[V any](slice []V, i int) (prev int, value V)
-
func Reverse[V any](slice []V)
-
func Shuffle[V any](slice []V)
-
func Swap[V any](slice []V, i, j int)
-
func ToMap[K comparable, V any](slice []V, key func(V) K) map[K]V
-
func ToSet[V comparable](slice []V) map[V]struct{}
func Copy[V any](slice []V) []V
Copy 复制特定切片
func CopyMatrix[V any](slice [][]V) [][]V
CopyMatrix 复制二维数组
func Del[V any](slice *[]V, index int)
Del 删除特定索引的元素
func Insert[V any](slice *[]V, index int, value V)
Insert 在特定索引插入元素
func Move[V any](slice *[]V, index, to int)
Move 移动特定索引
func NextLoop[V any](slice []V, i int) (next int, value V)
NextLoop 返回 i 的下一个数组成员,当 i 达到数组长度时从 0 开始
func PrevLoop[V any](slice []V, i int) (prev int, value V)
PrevLoop 返回 i 的上一个数组成员,当 i 为 0 时从数组末尾开始
func Reverse[V any](slice []V)
Reverse 反转数组
func Shuffle[V any](slice []V)
Shuffle 随机打乱数组
func Swap[V any](slice []V, i, j int)
Swap 交换数组中的两个元素
func ToMap[K comparable, V any](slice []V, key func(V) K) map[K]V
ToMap 将数组转换为 map
func ToSet[V comparable](slice []V) map[V]struct{}
ToSet 将数组转换为 set
Source Files
¶
Click to show internal directories.
Click to hide internal directories.