package slice
import "k8s.io/kubectl/pkg/util/slice"
Index ¶
- func Contains[T comparable](slice []T, s T, modifier func(s T) T) bool
- func ContainsString(slice []string, s string, modifier func(s string) string) bool
- func SortInts64(a []int64)
- func ToSet[T comparable](slices ...[]T) []T
Functions ¶
func Contains ¶
func Contains[T comparable](slice []T, s T, modifier func(s T) T) bool
Contains checks if a given slice of type T contains the provided item. If a modifier func is provided, it is called with the slice item before the comparation.
func ContainsString ¶
ContainsString checks if a given slice of strings contains the provided string. If a modifier func is provided, it is called with the slice item before the comparation. Deprecated: Use Contains[T] instead
func SortInts64 ¶
func SortInts64(a []int64)
SortInts64 sorts []int64 in increasing order
func ToSet ¶
func ToSet[T comparable](slices ...[]T) []T
ToSet returns a single slice containing the unique values from one or more slices. The order of the items in the result is not guaranteed.
Source Files ¶
slice.go
- Version
- v0.33.0 (latest)
- Published
- Apr 23, 2025
- Platform
- linux/amd64
- Imports
- 1 packages
- Last checked
- 1 month ago –
Tools for package owners.