slice

package module
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Nov 24, 2024 License: MIT Imports: 5 Imported by: 43

README

slice

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Equal added in v0.1.0

func Equal[T comparable](a, b []T) bool

Equal compares two slices of comparable types.

func Index added in v0.0.2

func Index[T comparable](items []T, item T) int

Index returns index of an item in a slice

func Merge added in v0.2.0

func Merge[T comparable](source []T, slices ...[]T) (result []T, changed bool)

func RemoveInPlace added in v0.0.2

func RemoveInPlace[T any](slice []T, f func(v T) bool) (items []T, removedCount int)

RemoveInPlace removes an item from a slice in place without new memory allocation

func RemoveInPlaceByValue added in v0.3.0

func RemoveInPlaceByValue[T comparable](slice []T, v T) []T

RemoveInPlaceByValue removes an item from a slice in place without new memory allocation

func RemoveMulti added in v0.2.0

func RemoveMulti[T comparable](source, remove []T) (result []T, removedCount int)

func SameUniqueValues added in v0.1.3

func SameUniqueValues[T comparable](a, b []T) bool

SameUniqueValues compares two slices of comparable types.

func Shuffle added in v0.2.0

func Shuffle[T any](s []T, r *rand.Rand)

Shuffle pseudo-randomizes the order of elements.

Types

type CommaSeparatedUniqueValuesList added in v0.2.0

type CommaSeparatedUniqueValuesList string

func (CommaSeparatedUniqueValuesList) Add added in v0.2.0

func (CommaSeparatedUniqueValuesList) Contains added in v0.2.0

func (csv CommaSeparatedUniqueValuesList) Contains(v string) bool

func (CommaSeparatedUniqueValuesList) Remove added in v0.2.0

func (CommaSeparatedUniqueValuesList) String added in v0.2.0

func (CommaSeparatedUniqueValuesList) Strings added in v0.2.0

func (csv CommaSeparatedUniqueValuesList) Strings() []string

type CommaSeparatedValuesList added in v0.2.0

type CommaSeparatedValuesList string

func (CommaSeparatedValuesList) Add added in v0.2.0

func (CommaSeparatedValuesList) Contains added in v0.2.0

func (csv CommaSeparatedValuesList) Contains(v string) bool

func (CommaSeparatedValuesList) Count added in v0.2.0

func (csv CommaSeparatedValuesList) Count() int

func (CommaSeparatedValuesList) Remove added in v0.2.0

func (CommaSeparatedValuesList) Set added in v0.2.0

func (CommaSeparatedValuesList) String added in v0.2.0

func (csv CommaSeparatedValuesList) String() string

func (CommaSeparatedValuesList) Strings added in v0.2.0

func (csv CommaSeparatedValuesList) Strings() []string

Jump to

Keyboard shortcuts

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