slices

package
v0.5.2 Latest Latest
Warning

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

Go to latest
Published: Sep 30, 2025 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Difference

func Difference[V comparable](a, b []V) []V

Difference returns a slice that contains all elements of the first input slice without the elements of the second input slice

func Intersection

func Intersection[V comparable](a, b []V) []V

Intersection returns a slice that contains all elements that are contained in both slices

func Remove

func Remove[T comparable](items []T, toRemove T) ([]T, bool)

Remove removes the first occurrence of the input item from the input slice

func Repeat

func Repeat[T any](item T, times int) []T

Repeat returns a slice with the same element repeated {{times}} times

Types

type SortedSlice added in v0.5.2

type SortedSlice[T constraints.Ordered] []T

func (*SortedSlice[T]) Add added in v0.5.2

func (s *SortedSlice[T]) Add(t T)

Jump to

Keyboard shortcuts

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