slicetools

package
v0.0.11 Latest Latest
Warning

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

Go to latest
Published: May 7, 2024 License: MIT Imports: 0 Imported by: 5

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Chunks

func Chunks[T any](items []T, chunkSize int) [][]T

Chunks splits a slice into chunks of the given size.

func Concat added in v0.0.5

func Concat[T any](slices ...[]T) []T

Concat concatenates multiple slices and returns the result.

func Deduplicate added in v0.0.8

func Deduplicate[T comparable](slice []T) []T

Deduplicate filters a slice of any comparable type, removing duplicate elements in place. Keeps the order of the original slice. The original slice can't be used after calling this function because it's likely to have a different length.

func UniqueCopy added in v0.0.8

func UniqueCopy[T comparable](slice []T) []T

UniqueCopy filters a slice of any comparable type, returning a slice of unique elements. Keeps the order of the original slice.

Types

This section is empty.

Jump to

Keyboard shortcuts

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