Documentation
¶
Index ¶
- type HashSet
- func (self HashSet[TKey]) Add(keys ...TKey)
- func (self HashSet[TKey]) AddAll(other HashSet[TKey])
- func (self HashSet[TKey]) Clear()
- func (self HashSet[TKey]) Clone() HashSet[TKey]
- func (self HashSet[TKey]) Contains(key TKey) bool
- func (self HashSet[TKey]) ContainsAll(keys []TKey) bool
- func (self HashSet[TKey]) ContainsAny(keys []TKey) bool
- func (self HashSet[TKey]) DeepCloneBy(clone func(TKey) TKey) HashSet[TKey]
- func (self HashSet[TKey]) Difference(other HashSet[TKey]) HashSet[TKey]
- func (self HashSet[TKey]) Equal(other HashSet[TKey]) bool
- func (self HashSet[TKey]) Filter(fn func(TKey) bool) HashSet[TKey]
- func (self HashSet[TKey]) ForEach(fn func(TKey))
- func (self HashSet[TKey]) Intersection(other HashSet[TKey]) HashSet[TKey]
- func (self HashSet[TKey]) IsEmpty() bool
- func (self HashSet[TKey]) Iter() iter.Iter[TKey]
- func (self HashSet[TKey]) Map(fn func(TKey) TKey) HashSet[TKey]
- func (self HashSet[TKey]) MarshalJSON() ([]byte, error)
- func (self HashSet[TKey]) Remove(key TKey)
- func (self HashSet[TKey]) RemoveBy(predicate func(TKey) bool)
- func (self HashSet[TKey]) Size() int
- func (self HashSet[TKey]) SubsetOf(other HashSet[TKey]) bool
- func (self HashSet[TKey]) SupersetOf(other HashSet[TKey]) bool
- func (self HashSet[TKey]) SymmetricDifference(other HashSet[TKey]) HashSet[TKey]
- func (self HashSet[TKey]) ToMap() map[TKey]struct{}
- func (self HashSet[TKey]) ToSlice() []TKey
- func (self HashSet[TKey]) Union(other HashSet[TKey]) HashSet[TKey]
- func (self HashSet[TKey]) UnionAssign(other HashSet[TKey])
- func (self HashSet[TKey]) UnmarshalJSON(v []byte) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type HashSet ¶
type HashSet[TKey comparable] struct { // contains filtered or unexported fields }
func FromMapKey ¶ added in v0.3.0
func FromMapKey[TKey comparable, TValue any, M ~map[TKey]TValue](m M) HashSet[TKey]
func Map ¶
func Map[TKey, TNewKey comparable]( set HashSet[TKey], fn func(TKey) TNewKey, ) HashSet[TNewKey]
func NewHashSet ¶
func NewHashSet[TKey comparable](elements ...TKey) HashSet[TKey]
NewHashSet returns a new empty hash set.
func (HashSet[TKey]) Add ¶
func (self HashSet[TKey]) Add(keys ...TKey)
Add adds the given keys to the set.
func (HashSet[TKey]) ContainsAll ¶
ContainsAll returns true if all the given keys are in the set.
func (HashSet[TKey]) ContainsAny ¶
ContainsAny returns true if any of the given keys are in the set.
func (HashSet[TKey]) DeepCloneBy ¶
DeepCloneBy returns a copy of the set and clone each element use given clone func.
func (HashSet[TKey]) Difference ¶
Difference returns a new set containing all the elements that are in this set but not in the other set.
func (HashSet[TKey]) Intersection ¶
Intersection returns a new set containing all the elements that are in both sets.
func (HashSet[TKey]) Iter ¶ added in v0.3.0
Iter returns a iter.Iter that iterate over the keys in the set.
func (HashSet[TKey]) MarshalJSON ¶ added in v0.3.0
func (HashSet[TKey]) Remove ¶
func (self HashSet[TKey]) Remove(key TKey)
Remove removes the given key from the set.
func (HashSet[TKey]) RemoveBy ¶
RemoveBy remove keys from the set if the given predicate returns true.
func (HashSet[TKey]) SupersetOf ¶
SupersetOf returns true if the given set is a superset of this set.
func (HashSet[TKey]) SymmetricDifference ¶
SymmetricDifference returns a new set containing all the elements that are in this set or the other set but not in both.
func (HashSet[TKey]) ToSlice ¶
func (self HashSet[TKey]) ToSlice() []TKey
ToSlice returns a slice containing all elements in the set.
func (HashSet[TKey]) Union ¶
Union returns a new set containing all the elements that are in either set.
func (HashSet[TKey]) UnionAssign ¶ added in v0.3.0
UnionAssign union another HashSet into self