Documentation ¶
Index ¶
- type Set
- func (s Set[T]) Add(items ...T) Set[T]
- func (s Set[T]) Equal(set 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]) Intersection(set Set[T]) Set[T]
- func (s Set[T]) Len() int
- func (s Set[T]) List() []T
- func (s Set[T]) NotIn(set Set[T]) Set[T]
- func (s Set[T]) Remove(items ...T) Set[T]
- func (s Set[T]) Union(set Set[T]) Set[T]
- type String
- func (s String) Add(items ...string) String
- func (s String) Equal(set String) bool
- func (s String) Has(item string) bool
- func (s String) HasAll(items ...string) bool
- func (s String) HasAny(items ...string) bool
- func (s String) Intersection(set String) String
- func (s String) Len() int
- func (s String) List() []string
- func (s String) NotIn(set String) String
- func (s String) Remove(items ...string) String
- func (s String) SortedList() []string
- func (s String) Union(set String) String
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Set ¶
type Set[T comparable] map[T]struct{}
func New ¶
func New[T comparable](items ...T) Set[T]
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]) NotIn ¶
NotIn returns a set of objects that are not in the current set. For example: s1 = {a1, a2, a3} s2 = {a1, a2, a4, a5} s1.NotIn(s2) = {a3} s2.NotIn(s1) = {a4, a5}
type String ¶
type String map[string]struct{}
func (String) 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 (String) NotIn ¶
NotIn returns a set of objects that are not in the current set. For example: s1 = {a1, a2, a3} s2 = {a1, a2, a4, a5} s1.NotIn(s2) = {a3} s2.NotIn(s1) = {a4, a5}
func (String) SortedList ¶
SortedList returns the contents as a sorted string slice.