slice

package
v0.0.18 Latest Latest
Warning

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

Go to latest
Published: Jul 23, 2024 License: Apache-2.0 Imports: 0 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Complement added in v0.0.15

func Complement[T comparable](sliceAll, slicePart []T, compare ...func(*T, *T) bool) []T

Complement 求两个切片的补集 全集中(sliceAll)不属于某个集合(slicePart)的元素所组成的集合

func Contains

func Contains[T comparable](slice []T, elem T, compare ...func(*T, *T) bool) bool

Contains 检查指定的元素是否存在切片中 compare 比较函数,如果为空 则直接使用值比较

func Filter added in v0.0.15

func Filter[T comparable](slice []T, filter func(item *T) bool) []T

Filter 筛选切片 通过函数筛选出符合要求的元素

func Intersection added in v0.0.15

func Intersection[T comparable](sliceA, sliceB []T, compare ...func(*T, *T) bool) []T

Intersection 求两个切片的交集 两个集合中共同的元素所组成的集合

func Union added in v0.0.15

func Union[T comparable](sliceA, sliceB []T, compare ...func(*T, *T) bool) []T

Union 求两个切片的并集 两个集合中所有元素(不重复)所组成的集合。

Types

This section is empty.

Jump to

Keyboard shortcuts

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