slicex

package
v2.3.33 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Fill added in v2.2.109

func Fill[T any](value T, number int) []T

Fill fills the slice with the given number of values

func Filter

func Filter[T any](values []T, predicate func(value T) bool) []T

Filter does what it says and creates a new list with all values which evaluate the predicate to true.

func MakeWithCapacity

func MakeWithCapacity[T any](cap int) []T

MakeWithCapacity exists to simply create a slice with the provided pre-allocated capacity. Why not just use `make([]T, cap)` you might ask? Well, cause that's broken again. You've missed the zero indicating a length of zero - again. Thanks go.

func Map

func Map[T any, R any](input []T, mapper func(T) R) []R

Map applies the mapper function to each item of the input slice and returns a new slice with the mapped values.

Types

This section is empty.

Jump to

Keyboard shortcuts

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