slice

package
v1.0.8 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 29, 2024 License: BSD-3-Clause Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InsertAt added in v1.0.4

func InsertAt[E any](s []E, i int, v E) []E

InsertAt 把`v`插入到第`i`个位置

func OrderedContains

func OrderedContains[T cmp.Ordered](set []T, elem T) bool

OrderedContains `elem`是否在有序数组`set`中

func OrderedDelete

func OrderedDelete[T cmp.Ordered](set []T, elem T) []T

OrderedDelete 把`n`从有序数组中删除

func OrderedIndexOf

func OrderedIndexOf[T cmp.Ordered](set []T, elem T) int

OrderedIndexOf `elem`在有序数组`set`中的索引,如果不存在返回-1

func OrderedIntersect

func OrderedIntersect[T cmp.Ordered](a, b []T) []T

OrderedIntersect 有序数组交集, A ∩ B

func OrderedUnion

func OrderedUnion[T cmp.Ordered](a, b []T) []T

OrderedUnion 有序数组并集, A ∪ B

func PutIfAbsent

func PutIfAbsent[T cmp.Ordered](set []T, elem T) []T

PutIfAbsent 插入`n`到有序数组

func RemoveAt added in v1.0.4

func RemoveAt[E any](s []E, i int) []E

RemoveAt 删除第`i`个元素,不保证原来元素的顺序

func Shrink

func Shrink[E any](s []E) []E

func Shuffle

func Shuffle[E any](s []E)

Types

type Float32Slice

type Float32Slice []float32

func (Float32Slice) Len

func (x Float32Slice) Len() int

func (Float32Slice) Less

func (x Float32Slice) Less(i, j int) bool

func (Float32Slice) Swap

func (x Float32Slice) Swap(i, j int)

type Float64Slice

type Float64Slice = sort.Float64Slice

type Int16Slice

type Int16Slice []int16

func (Int16Slice) Len

func (x Int16Slice) Len() int

func (Int16Slice) Less

func (x Int16Slice) Less(i, j int) bool

func (Int16Slice) Swap

func (x Int16Slice) Swap(i, j int)

type Int32Slice

type Int32Slice []int32

func (Int32Slice) Len

func (x Int32Slice) Len() int

func (Int32Slice) Less

func (x Int32Slice) Less(i, j int) bool

func (Int32Slice) Swap

func (x Int32Slice) Swap(i, j int)

type Int64Slice

type Int64Slice []int64

func (Int64Slice) Len

func (x Int64Slice) Len() int

func (Int64Slice) Less

func (x Int64Slice) Less(i, j int) bool

func (Int64Slice) Swap

func (x Int64Slice) Swap(i, j int)

type Int8Slice

type Int8Slice []int8

func (Int8Slice) Len

func (x Int8Slice) Len() int

func (Int8Slice) Less

func (x Int8Slice) Less(i, j int) bool

func (Int8Slice) Swap

func (x Int8Slice) Swap(i, j int)

type IntSlice

type IntSlice = sort.IntSlice

type StringSlice

type StringSlice = sort.StringSlice

type Uint16Slice

type Uint16Slice []uint16

func (Uint16Slice) Len

func (x Uint16Slice) Len() int

func (Uint16Slice) Less

func (x Uint16Slice) Less(i, j int) bool

func (Uint16Slice) Swap

func (x Uint16Slice) Swap(i, j int)

type Uint32Slice

type Uint32Slice []uint32

func (Uint32Slice) Len

func (x Uint32Slice) Len() int

func (Uint32Slice) Less

func (x Uint32Slice) Less(i, j int) bool

func (Uint32Slice) Swap

func (x Uint32Slice) Swap(i, j int)

type Uint64Slice

type Uint64Slice []uint64

func (Uint64Slice) Len

func (x Uint64Slice) Len() int

func (Uint64Slice) Less

func (x Uint64Slice) Less(i, j int) bool

func (Uint64Slice) Swap

func (x Uint64Slice) Swap(i, j int)

type Uint8Slice

type Uint8Slice []uint8

func (Uint8Slice) Len

func (x Uint8Slice) Len() int

func (Uint8Slice) Less

func (x Uint8Slice) Less(i, j int) bool

func (Uint8Slice) Swap

func (x Uint8Slice) Swap(i, j int)

type UintSlice

type UintSlice []uint

func (UintSlice) Len

func (x UintSlice) Len() int

func (UintSlice) Less

func (x UintSlice) Less(i, j int) bool

func (UintSlice) Swap

func (x UintSlice) Swap(i, j int)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL