slice
packageThis package is not in the latest version of its module.
Details
Validgo.mod file
The Go module system was introduced in Go 1.11 and is the official dependency management solution for Go.
Redistributable license
Redistributable licenses place minimal restrictions on how software can be used, modified, and redistributed.
Tagged version
Modules with tagged versions give importers more predictable builds.
Stable version
When a project reaches major version v1 it is considered stable.
- Learn more about best practices
Repository
Links
Documentation¶
Index¶
- func Contains[T comparable](haystack []T, needle T) bool
- func ContainsCompare[T any](haystack []T, needle T, equal func(a, b T) bool) bool
- func New[T any](items ...T) []T
- func Overlap[T comparable](a []T, b []T) bool
- func OverlapCompare[T any](a []T, b []T, equal func(a, b T) bool) bool
- func SameElements[T comparable](a []T, b []T) bool
- func Unique[T comparable](a []T) []T
Constants¶
This section is empty.
Variables¶
This section is empty.
Functions¶
funcContains¶
func Contains[Tcomparable](haystack []T, needle T)bool
funcContainsCompare¶added inv0.7.5
funcOverlap¶added inv0.7.5
func Overlap[Tcomparable](a []T, b []T)bool
Overlap returns if the 2 sets have any overlap (element(s) in common)
funcOverlapCompare¶added inv0.7.5
funcSameElements¶added inv0.17.0
func SameElements[Tcomparable](a []T, b []T)bool
SameElements returns true if the 2 lists have the same elements in anyorder.
funcUnique¶added inv0.11.0
func Unique[Tcomparable](a []T) []T
Unique returns a new slice with all duplicate elements removed.This is a slow function on large lists.TODO: Sort elements and implement a faster search algorithm if wereally start to use this.
Types¶
This section is empty.