Documentation ¶
Index ¶
- func Complement[T comparable](sliceAll, slicePart []T, compare ...func(*T, *T) bool) []T
- func Contains[T comparable](slice []T, elem T, compare ...func(*T, *T) bool) bool
- func Filter[T comparable](slice []T, filter func(item *T) bool) []T
- func Intersection[T comparable](sliceA, sliceB []T, compare ...func(*T, *T) bool) []T
- func Union[T comparable](sliceA, sliceB []T, compare ...func(*T, *T) bool) []T
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.
Click to show internal directories.
Click to hide internal directories.