Documentation ¶
Index ¶
- func Count[T constraints.Ordered](s []T, target T) int
- func CountIf[T any](s []T, checkFn func(T) bool) int
- func MaxValueAndIndex[T constraints.Ordered](s []T) (max T, idx int)
- func OrderedSlice[T constraints.Ordered](s []T)
- func PushFront[T any](s []T, item T) []T
- func RemoveAt[T any](a []T, i int) []T
- func RemoveHead[T any](items []T, k int) []T
- func RemoveTail[T any](items []T, k int) []T
- func Reverse[T any](s []T)
- func RotateLeft[T any](items []T, k int)
- func RotateRight[T any](items []T, k int)
- func SliceFn[T any](s []T, cmp func(T, T) bool)
- func SortAscUniq[T constraints.Ordered](s []T) []T
- func SortDescUniq[T constraints.Ordered](s []T) []T
- func UniqSorted[T constraints.Ordered](s []T) []T
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Count ¶
func Count[T constraints.Ordered](s []T, target T) int
func MaxValueAndIndex ¶
func MaxValueAndIndex[T constraints.Ordered](s []T) (max T, idx int)
MaxValueAndIndex return max value and the index of first max
func OrderedSlice ¶
func OrderedSlice[T constraints.Ordered](s []T)
OrderedSlice sorts the slice s in ascending order. The elements of s must be ordered using the < operator.
func RemoveHead ¶
func RemoveTail ¶
func RotateLeft ¶
func RotateRight ¶
func SliceFn ¶
SliceFn sorts the slice s according to the function cmp. Usage:
var s []*Person ... sort.SliceFn(s, func(p1, p2 *Person) bool { return p1.Name < p2.Name })
func SortAscUniq ¶ added in v0.2.11
func SortAscUniq[T constraints.Ordered](s []T) []T
func SortDescUniq ¶ added in v0.2.11
func SortDescUniq[T constraints.Ordered](s []T) []T
func UniqSorted ¶ added in v0.2.11
func UniqSorted[T constraints.Ordered](s []T) []T
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.