Documentation
¶
Index ¶
- type Empty
- type Set
- func (s Set[T]) Clone() Set[T]
- func (s Set[T]) Delete(items ...T) Set[T]
- func (s Set[T]) Difference(s2 Set[T]) Set[T]
- func (s Set[T]) Equal(s2 Set[T]) bool
- func (s Set[T]) Has(item T) bool
- func (s Set[T]) HasAll(items ...T) bool
- func (s Set[T]) HasAny(items ...T) bool
- func (s Set[T]) Insert(items ...T) Set[T]
- func (s Set[T]) Intersection(s2 Set[T]) Set[T]
- func (s Set[T]) IsSuperset(s2 Set[T]) bool
- func (s Set[T]) Len() int
- func (s Set[T]) List() []T
- func (s Set[T]) PopAny() (T, bool)
- func (s Set[T]) Union(s2 Set[T]) Set[T]
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Set ¶
type Set[T comparable] map[T]Empty
Set implements a generic implementation of k8s.io/apimachinery/pkg/util/sets TODO: Remove our local generic implementation when migrating to a later version of https://github.com/kubernetes/apimachinery/blob/master/pkg/util/sets/set.go
func New ¶
func New[T comparable](items ...T) Set[T]
func (Set[T]) Difference ¶
Difference returns a set of objects that are not in s2 For example: s1 = {a1, a2, a3} s2 = {a1, a2, a4, a5} s1.Difference(s2) = {a3} s2.Difference(s1) = {a4, a5}
func (Set[T]) Intersection ¶
Intersection returns a new set which includes the item in BOTH s1 and s2 For example: s1 = {a1, a2} s2 = {a2, a3} s1.Intersection(s2) = {a2}
func (Set[T]) IsSuperset ¶
IsSuperset returns true if and only if s1 is a superset of s2.
func (Set[T]) List ¶
func (s Set[T]) List() []T
List returns the slice with contents in random order.