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