Documentation ¶
Index ¶
- func Count[T comparable](data []T, value T) int
- func CountIf[T comparable](data []T, predicate func(value T) bool) int
- func Fill[T any](data []T, value T)
- func Find[T comparable](data []T, value T) bool
- func FindIf[T any](data []T, defaultValue T, predicate func(value T) bool) T
- func Max[T constraints.Ordered](first, second T) T
- func MaxElement[T constraints.Ordered](data []T, defaultValue T) T
- func Min[T constraints.Ordered](first, second T) T
- func MinElement[T constraints.Ordered](data []T, defaultValue T) T
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 Fill ¶ added in v0.2.0
func Fill[T any](data []T, value T)
Fills the given slice with the given value
func Find ¶
func Find[T comparable](data []T, value T) bool
Finds the given value in the given slice, returns true if it is found. Returns false if nothing found or the slice is empty.
func FindIf ¶
Finds a value satisfying the given predicate in the given slice and returns it. Returns defaultValue if nothing found or the slice is empty.
func Max ¶ added in v0.1.7
func Max[T constraints.Ordered](first, second T) T
Returns the maxmimum of two values
func MaxElement ¶
func MaxElement[T constraints.Ordered](data []T, defaultValue T) T
Finds a maximal value in the given slice and returns it. Returns defaultValue if the slice is empty
func Min ¶ added in v0.1.7
func Min[T constraints.Ordered](first, second T) T
Returns the minimum of two values
func MinElement ¶
func MinElement[T constraints.Ordered](data []T, defaultValue T) T
Finds a minimal value in the given slice and returns it. Returns defaultValue if the slice is empty
Types ¶
This section is empty.