slice

package
v1.9.2 Latest Latest
Warning

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

Go to latest
Published: Mar 12, 2024 License: MIT Imports: 1 Imported by: 11

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func All added in v1.2.6

func All[T any](source []T, predicate func(T) bool) bool

Determines whether all elements of a slice satisfy a condition.

func Any added in v1.2.6

func Any[T any](source []T, predicate func(T) bool) bool

Determines whether any element of a slice satisfies a condition.

func FindAll added in v1.2.7

func FindAll[T any](source []T, predicate func(T) bool) []T

Retrieves all the elements that match the conditions defined by the specified predicate.

func FindFirst added in v1.2.12

func FindFirst[T any](source []T, predicate func(T) bool) (element T, ok bool)

Returns the first element matching the predicate. 'ok' is true if an element was found and false if not.

func FindIndex added in v1.2.9

func FindIndex[T any](source []T, predicate func(T) bool) int

Returns the index of the first element matching the predicate or -1 on fail

func Map added in v1.2.5

func Map[T, V any](source []T, mapper func(T) V) []V

Projects each element of a slice into a new form.

func PointersOf

func PointersOf(v interface{}) interface{}

PointersOf Returnes a pointer of

func Reduce added in v1.2.8

func Reduce[TSource, TAccumulation any](source []TSource, seed TAccumulation, accumulator func(TAccumulation, TSource) TAccumulation) TAccumulation

Applies an accumulator function over a slice. The specified seed value is used as the initial accumulator value.

Types

This section is empty.

Jump to

Keyboard shortcuts

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