sliceutil

package
v0.14.2 Latest Latest
Warning

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

Go to latest
Published: Sep 8, 2023 License: AGPL-3.0 Imports: 0 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Contains

func Contains[T comparable](s []T, e T) bool

Contains returns true if s slice contains e element.

func Copy

func Copy[T any](s []T) []T

Copy returns a copy of the slice.

func Filter added in v0.11.0

func Filter[T any](s []T, f func(T) bool) []T

Filter returns a new slice with the elements of the original slice that satisfy the predicate f.

func IndexOf added in v0.13.10

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 added in v0.13.4

func Intersect[T comparable](slices ...[]T) []T

Intersect returns a new slice with the elements that are present in all slices.

func IsUnique added in v0.11.0

func IsUnique[T comparable](s []T) bool

IsUnique returns true if all elements in the slice are unique.

func Map added in v0.10.2

func Map[T, U any](s []T, f func(T) U) []U

Map returns a new slice with the results of applying the function f to each element of the original slice.

func Put added in v0.13.5

func Put[T comparable](s []T, e ...T) []T

Types

This section is empty.

Jump to

Keyboard shortcuts

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