Documentation
¶
Index ¶
- func All[T any](source []T, predicate func(T) bool) bool
- func Any[T any](source []T, predicate func(T) bool) bool
- func ElementsMatch[S ~[]E, E comparable](s1, s2 S) bool
- func FindAll[T any](source []T, predicate func(T) bool) []T
- func FindFirst[T any](source []T, predicate func(T) bool) (element T, ok bool)
- func FindIndex[T any](source []T, predicate func(T) bool) int
- func Map[T, V any](source []T, mapper func(T) V) []V
- func PointersOf[S ~[]E, E any](s S) []*E
- func Reduce[TSource, TAccumulation any](source []TSource, seed TAccumulation, ...) TAccumulation
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ElementsMatch ¶ added in v1.13.0
func ElementsMatch[S ~[]E, E comparable](s1, s2 S) bool
ElementsMatch reports whether two slices are equal: the same length and all elements exist in both slices, ignoring the order of the elements. If there are duplicate elements, the number of appearances of each of them in both slices should match.
func FindAll ¶ added in v1.2.7
Retrieves all the elements that match the conditions defined by the specified predicate.
func FindFirst ¶ added in v1.2.12
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
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[S ~[]E, E any](s S) []*E
PointersOf returns a slice of pointers to each element in the provided slice.
Types ¶
This section is empty.