slice

package
v0.4.0-alpha.3 Latest Latest
Warning

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

Go to latest
Published: Jan 24, 2025 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Contains

func Contains[T any](elems []T, v T) bool

Contains returns true if a slice contains an element

func ContainsString

func ContainsString(slice []string, s string) bool

ContainsString tests if list of strings contains one specific string `s`

func Deduplicate

func Deduplicate[T any](elems []T) []T

func Find

func Find[T any](input []T, finder func(T, int) bool) *T

func ForEach

func ForEach[T any](elems []T, fn func(T))

func IndexOf

func IndexOf[T any](elems []T, v T) int

IndexOf returns the index of an element in a slice, if exists (otherwise -1)

func Intersects

func Intersects[T comparable](s1 []T, s2 []T) bool

Intersects returns true if two slices have at least 1 common element

func IsEquivalent

func IsEquivalent(a *[]string, b *[]string) bool

IsEquivalent returns true if two string slices contain the same items agnostic to item order

func Map

func Map[T any, R any](elems []T, fn func(T) R) []R

func Remove

func Remove[T comparable](elems []T, v T) []T

Remove removes an element of a generic slice

func RemoveString

func RemoveString(slice []string, s string) (result []string)

RemoveString from slice

Types

This section is empty.

Jump to

Keyboard shortcuts

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