Documentation
¶
Index ¶
- func Count[T comparable](data []T, value T) int
- func CountIf[T comparable](data []T, predicate func(value T) bool) int
- func Find[T comparable](data []T, value T) int
- func FindIf[T any](data []T, predicate func(value T) bool) int
- func MaxElement[T constraints.Ordered](data []T) int
- func MinElement[T constraints.Ordered](data []T) int
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Count ¶
func Count[T comparable](data []T, value T) int
counts all occurrences of the given value in the given slice
func CountIf ¶
func CountIf[T comparable](data []T, predicate func(value T) bool) int
counts all occurrences of values satisfying the given predicate in the given slice
func Find ¶
func Find[T comparable](data []T, value T) int
finds the given value in the given slice returns -1 if nothing found or the slice is empty
func FindIf ¶
finds a value satisfying the given predicate in the given slice returns -1 if nothing found or the slice is empty
func MaxElement ¶
func MaxElement[T constraints.Ordered](data []T) int
finds a maximal value in the given slice and returns its index returns -1 if the slice is empty
func MinElement ¶
func MinElement[T constraints.Ordered](data []T) int
finds a minimal value in the given slice and returns its index returns -1 if the slice is empty
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.