Documentation ¶
Index ¶
- func AppendUnique[T comparable](s []T, e T) []T
- func Contains[T comparable](s []T, e T) bool
- func ContainsAll[T comparable](s []T, e []T) bool
- func Copy[T any](s []T) []T
- func Filter[T any](s []T, f func(T) bool) []T
- func IndexOf[T comparable](s []T, e T) int
- func Intersect[T comparable](slices ...[]T) []T
- func IsUnique[T comparable](s []T) bool
- func Map[T, U any](s []T, f func(T) U) []U
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AppendUnique ¶
func AppendUnique[T comparable](s []T, e T) []T
AppendUnique appends e to s if e is not already present in s.
func Contains ¶
func Contains[T comparable](s []T, e T) bool
Contains returns true if s slice contains e element.
func ContainsAll ¶
func ContainsAll[T comparable](s []T, e []T) bool
ContainsAll returns true if s slice contains all elements in e slice.
func Filter ¶
Filter returns a new slice with the elements of the original slice that satisfy the predicate f.
func IndexOf ¶
func IndexOf[T comparable](s []T, e T) int
IndexOf returns the index of the first occurrence of e in s, or -1 if e is not present in s.
func Intersect ¶
func Intersect[T comparable](slices ...[]T) []T
Intersect returns a new slice with the elements that are present in all slices.
func IsUnique ¶
func IsUnique[T comparable](s []T) bool
IsUnique returns true if all elements in the slice are unique.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.