Documentation ¶
Index ¶
- func Any[T any](ts []T, predicate func(t T) bool) bool
- func CastAll[SS ~[]S, S any, TS ~[]T, T any](ss SS) TS
- func Clone[TS ~[]T, T any](source TS) TS
- func Contains[T comparable](ts []T, other T) bool
- func Count[S any](ss []S, p types.Predicate[S]) int
- func DeepClone[SS ~[]S, S types.Cloneable[S]](source SS) SS
- func Filter[SS ~[]S, S any](ss SS, p types.Predicate[S]) SS
- func FilterNonNil[TS ~[]*T, T any](ts TS) TS
- func FilterNot[SS ~[]S, S any](ss SS, p types.Predicate[S]) SS
- func Find[S any](ss []S, p types.Predicate[S]) (S, bool)
- func FlatMap[SS ~[]S, S any, TS ~[]T, T any](ss SS, m types.Mapper[S, TS]) TS
- 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 JoinDistinct[TS ~[]T, T comparable](es ...TS) TS
- 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[TS ~[]T, T types.Comparable[T]](ts TS, toRemove T) TS
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CastAll ¶ added in v0.11.0
CastAll converts the type of all elements of the slice If an element cannot be converted, it will panic
func Contains ¶ added in v0.15.0
func Contains[T comparable](ts []T, other T) bool
Contains returns true if the slice contains the given element
func FilterNonNil ¶
func FilterNonNil[TS ~[]*T, T any](ts TS) TS
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
Has2 returns true if the slice contains the given element Deprecated: use Contains instead
func Index ¶
func Index[S comparable](ss []S, toFind S) int
func Index2 ¶
func Index2[S comparable](ss []S, toFind S) (int, bool)
func JoinDistinct ¶ added in v0.7.0
func JoinDistinct[TS ~[]T, T comparable](es ...TS) TS
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[TS ~[]T, T types.Comparable[T]](ts TS, toRemove T) TS
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.