Documentation ¶
Index ¶
- func Any[T any](ts []T, predicate func(t T) bool) bool
- func Clone[T any](source []T) []T
- func Count[S any](ss []S, p types.Predicate[S]) int
- func DeepClone[T types.Cloneable[T]](source []T) []T
- func Filter[S any](ss []S, p types.Predicate[S]) []S
- func FilterNonNil[T any](ts []*T) []*T
- func FilterNot[S any](ss []S, p types.Predicate[S]) []S
- func Find[S any](ss []S, p types.Predicate[S]) (S, bool)
- func FlatMap[S any, T any](ss []S, m types.Mapper[S, []T]) []T
- func Has[T types.Comparable[T]](ts []T, other T) bool
- func Has2[T comparable](ts []T, other T) bool
- func Index[S comparable](ss []S, toFind S) int
- func Index2[S comparable](ss []S, toFind S) (int, bool)
- func IndexBy[S any](ss []S, p types.Predicate[S]) int
- func IndexBy2[S any](ss []S, p types.Predicate[S]) (int, bool)
- func Map[S any, T any](ss []S, m types.Mapper[S, T]) []T
- func MapNonNil[S any, T any](ss []S, mapper types.Mapper[S, *T]) []T
- func MapWithError[S any, T any](ss []S, m types.MapperWithError[S, T]) ([]T, error)
- func Of[S any](ss ...S) []S
- func Reduce[Value any, Element any](initialValue Value, elements []Element, reducer func(Value, Element) Value) Value
- func Remove[T types.Comparable[T]](ts []T, toRemove T) []T
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FilterNonNil ¶
func FilterNonNil[T any](ts []*T) []*T
FilterNonNil returns all the elements of array that are non nil
func Has ¶
func Has[T types.Comparable[T]](ts []T, other T) bool
func Has2 ¶
func Has2[T comparable](ts []T, other T) bool
func Index ¶
func Index[S comparable](ss []S, toFind S) int
func Index2 ¶
func Index2[S comparable](ss []S, toFind S) (int, bool)
func MapNonNil ¶
MapNonNil apply mapper to all elements of 'ss' and return slice of all non-nil results
func MapWithError ¶ added in v0.6.6
func MapWithError[S any, T any](ss []S, m types.MapperWithError[S, T]) ([]T, error)
MapWithError applies mapper to all elements of 'ss' and returns slice of results. If mapper returns error, then it is returned immediately.
func Remove ¶
func Remove[T types.Comparable[T]](ts []T, toRemove T) []T
Remove all occurrences of the given element from the slice
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.