Documentation
¶
Index ¶
- type HashSet
- func (self HashSet[E]) Add(key E)
- func (self HashSet[E]) AddIter(it 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]) DifferenceIter(it iter.Seq[E]) HashSet[E]
- func (self HashSet[E]) Equal(other HashSet[E]) bool
- func (self HashSet[E]) EqualIter(it iter.Seq[E]) bool
- func (self HashSet[E]) Intersection(other HashSet[E]) HashSet[E]
- func (self HashSet[E]) IntersectionIter(it iter.Seq[E]) HashSet[E]
- func (self HashSet[E]) IsEmpty() bool
- func (self HashSet[E]) Iter() iter.Seq[E]
- func (self HashSet[E]) IterMut() iter.Seq[*SetItem[E]]
- func (self HashSet[E]) Remove(key E)
- func (self HashSet[E]) RemoveIter(it iter.Seq[E])
- func (self HashSet[E]) Retain(fn func(E) bool)
- func (self HashSet[E]) Size() int
- func (self HashSet[E]) SubsetOf(other HashSet[E]) bool
- func (self HashSet[E]) SubsetOfIter(it iter.Seq[E]) bool
- func (self HashSet[E]) SupersetOf(other HashSet[E]) bool
- func (self HashSet[E]) SupersetOfIter(it iter.Seq[E]) bool
- func (self HashSet[E]) SymmetricDifference(other HashSet[E]) HashSet[E]
- func (self HashSet[E]) SymmetricDifferenceIter(it iter.Seq[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]) UnionIter(it iter.Seq[E]) HashSet[E]
- type SetItem
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 FromIter ¶ added in v0.5.0
func FromIter[E comparable](s iter.Seq[E]) HashSet[E]
FromIter create a HashSet from iter.Seq.
func FromMapKeys ¶ added in v0.5.0
func FromMapKeys[E comparable, V any, M ~map[E]V](m M) HashSet[E]
func FromSlice ¶ added in v0.6.0
func FromSlice[E comparable](elements ...E) HashSet[E]
FromSlice returns a new empty hash set.
func New ¶ added in v0.6.0
func New[E comparable]() HashSet[E]
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]) DifferenceIter ¶ added in v0.6.0
func (HashSet[E]) Intersection ¶
Intersection returns a new set containing all the elements that are in both sets.
func (HashSet[E]) IntersectionIter ¶ added in v0.6.0
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]) Remove ¶
func (self HashSet[E]) Remove(key E)
Remove removes the given key from the set.
func (HashSet[E]) RemoveIter ¶ added in v0.6.0
RemoveIter removes all elements in iter.Seq.
func (HashSet[E]) Retain ¶ added in v0.6.0
Retain keep element that match the given predicate function.
Otherwise, remove from HashSet.
func (HashSet[E]) SubsetOfIter ¶ added in v0.6.0
func (HashSet[E]) SupersetOf ¶
SupersetOf returns true if the given set is a superset of this set.
func (HashSet[E]) SupersetOfIter ¶ added in v0.6.0
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.