slice

package
v1.0.0-rc5 Latest Latest
Warning

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

Go to latest
Published: Jan 15, 2025 License: MIT Imports: 0 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func All

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

All checks if all elements in the slice satisfy the condition

func Any

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

Any checks if any element in the slice satisfies the condition

func FindAll

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

FindAll returns all elements in the slice that satisfy the condition

func FindFirst

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

FindFirst returns the first element in the slice that satisfies the condition

func Reduce

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

Reduce applies a function against an accumulator and each element in the slice (from left to right) to reduce it to a single value.

Types

This section is empty.

Jump to

Keyboard shortcuts

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