Documentation
¶
Overview ¶
Package hashset provides hash-based set implementations for the datastructures interfaces.
Index ¶
- func NewComparable[E comparable](xs ...E) ds.MutableSet[E]
- func NewHashable[E ds.Hashable[E]](xs ...E) ds.MutableSet[E]
- type ConcurrentSet
- func (s *ConcurrentSet[E]) Add(e E)
- func (s *ConcurrentSet[E]) AddAll(es ...E)
- func (s *ConcurrentSet[_]) Cardinality() int
- func (s *ConcurrentSet[E]) Clear()
- func (s *ConcurrentSet[E]) Clone() ds.ConcurrentSet[E]
- func (s *ConcurrentSet[E]) Compute(e E, remappingFunction func(e E, exists bool) (E, bool)) E
- func (s *ConcurrentSet[E]) ComputeIfAbsent(e E, mappingFunction func(e E) (E, bool)) E
- func (s *ConcurrentSet[E]) ComputeIfPresent(e E, remappingFunction func(e E) (E, bool)) E
- func (s *ConcurrentSet[E]) Contains(e E) bool
- func (s *ConcurrentSet[E]) Difference(other ds.Set[E]) ds.ConcurrentSet[E]
- func (s *ConcurrentSet[E]) Equal(other ds.Set[E]) bool
- func (s *ConcurrentSet[E]) Intersection(other ds.Set[E]) ds.ConcurrentSet[E]
- func (s *ConcurrentSet[_]) IsEmpty() bool
- func (s *ConcurrentSet[E]) IsProperSubSet(other ds.Set[E]) bool
- func (s *ConcurrentSet[E]) IsProperSuperSet(other ds.Set[E]) bool
- func (s *ConcurrentSet[E]) IsSubSet(other ds.Set[E]) bool
- func (s *ConcurrentSet[E]) IsSuperSet(other ds.Set[E]) bool
- func (s *ConcurrentSet[E]) Iter() iter.Seq[E]
- func (s *ConcurrentSet[E]) Iter2() iter.Seq2[int, E]
- func (s *ConcurrentSet[E]) IterSubSets() iter.Seq[ds.Set[E]]
- func (s *ConcurrentSet[E]) List() []E
- func (s *ConcurrentSet[E]) Remove(e E)
- func (s *ConcurrentSet[E]) RemoveAll(es ...E)
- func (s *ConcurrentSet[_]) Size() int
- func (s *ConcurrentSet[E]) SubSets() []ds.Set[E]
- func (s *ConcurrentSet[E]) SymmetricDifference(other ds.Set[E]) ds.ConcurrentSet[E]
- func (s *ConcurrentSet[E]) Union(other ds.Set[E]) ds.ConcurrentSet[E]
- type ImmutableSet
- func (s *ImmutableSet[E]) Cardinality() int
- func (s *ImmutableSet[E]) Clone() ds.Set[E]
- func (s *ImmutableSet[E]) Contains(e E) bool
- func (s *ImmutableSet[E]) Difference(other ds.Set[E]) ds.Set[E]
- func (s *ImmutableSet[E]) Equal(other ds.Set[E]) bool
- func (s *ImmutableSet[E]) Intersection(other ds.Set[E]) ds.Set[E]
- func (s *ImmutableSet[E]) IsEmpty() bool
- func (s *ImmutableSet[E]) IsProperSubSet(of ds.Set[E]) bool
- func (s *ImmutableSet[E]) IsProperSuperSet(of ds.Set[E]) bool
- func (s *ImmutableSet[E]) IsSubSet(of ds.Set[E]) bool
- func (s *ImmutableSet[E]) IsSuperSet(of ds.Set[E]) bool
- func (s *ImmutableSet[E]) Iter() iter.Seq[E]
- func (s *ImmutableSet[E]) Iter2() iter.Seq2[int, E]
- func (s *ImmutableSet[E]) IterSubSets() iter.Seq[ds.Set[E]]
- func (s *ImmutableSet[E]) List() []E
- func (s *ImmutableSet[E]) Size() int
- func (s *ImmutableSet[E]) SubSets() []ds.Set[E]
- func (s *ImmutableSet[E]) SymmetricDifference(other ds.Set[E]) ds.Set[E]
- func (s *ImmutableSet[E]) Unfreeze() ds.MutableSet[E]
- func (s *ImmutableSet[E]) Union(other ds.Set[E]) ds.Set[E]
- type MutableComparableSet
- func (s *MutableComparableSet[E]) Add(e E)
- func (s *MutableComparableSet[E]) AddAll(es ...E)
- func (s *MutableComparableSet[_]) Cardinality() int
- func (s *MutableComparableSet[E]) Clear()
- func (s *MutableComparableSet[E]) Clone() ds.MutableSet[E]
- func (s *MutableComparableSet[E]) Contains(e E) bool
- func (s *MutableComparableSet[E]) Difference(other ds.MutableSet[E]) ds.MutableSet[E]
- func (s *MutableComparableSet[E]) Equal(other ds.MutableSet[E]) bool
- func (s *MutableComparableSet[E]) Freeze() ds.Set[E]
- func (s *MutableComparableSet[E]) Intersection(other ds.MutableSet[E]) ds.MutableSet[E]
- func (s *MutableComparableSet[_]) IsEmpty() bool
- func (s *MutableComparableSet[E]) IsProperSubSet(of ds.MutableSet[E]) bool
- func (s *MutableComparableSet[E]) IsProperSuperSet(of ds.MutableSet[E]) bool
- func (s *MutableComparableSet[E]) IsSubSet(of ds.MutableSet[E]) bool
- func (s *MutableComparableSet[E]) IsSuperSet(of ds.MutableSet[E]) bool
- func (s *MutableComparableSet[E]) Iter() iter.Seq[E]
- func (s *MutableComparableSet[E]) Iter2() iter.Seq2[int, E]
- func (s *MutableComparableSet[E]) IterSubSets() iter.Seq[ds.MutableSet[E]]
- func (s *MutableComparableSet[E]) List() []E
- func (s *MutableComparableSet[E]) Remove(e E)
- func (s *MutableComparableSet[E]) RemoveAll(es ...E)
- func (s *MutableComparableSet[_]) Size() int
- func (s *MutableComparableSet[E]) SubSets() []ds.MutableSet[E]
- func (s *MutableComparableSet[E]) SymmetricDifference(other ds.MutableSet[E]) ds.MutableSet[E]
- func (s *MutableComparableSet[E]) Union(other ds.MutableSet[E]) ds.MutableSet[E]
- type MutableHashableSet
- func (s *MutableHashableSet[E]) Add(e E)
- func (s *MutableHashableSet[E]) AddAll(es ...E)
- func (s *MutableHashableSet[_]) Cardinality() int
- func (s *MutableHashableSet[E]) Clear()
- func (s *MutableHashableSet[E]) Clone() ds.MutableSet[E]
- func (s *MutableHashableSet[E]) Contains(e E) bool
- func (s *MutableHashableSet[E]) Difference(other ds.MutableSet[E]) ds.MutableSet[E]
- func (s *MutableHashableSet[E]) Equal(other ds.MutableSet[E]) bool
- func (s *MutableHashableSet[E]) Freeze() ds.Set[E]
- func (s *MutableHashableSet[E]) HashCode() base.HashCode
- func (s *MutableHashableSet[E]) Intersection(other ds.MutableSet[E]) ds.MutableSet[E]
- func (s *MutableHashableSet[_]) IsEmpty() bool
- func (s *MutableHashableSet[E]) IsProperSubSet(of ds.MutableSet[E]) bool
- func (s *MutableHashableSet[E]) IsProperSuperSet(of ds.MutableSet[E]) bool
- func (s *MutableHashableSet[E]) IsSubSet(of ds.MutableSet[E]) bool
- func (s *MutableHashableSet[E]) IsSuperSet(of ds.MutableSet[E]) bool
- func (s *MutableHashableSet[E]) Iter() iter.Seq[E]
- func (s *MutableHashableSet[E]) Iter2() iter.Seq2[int, E]
- func (s *MutableHashableSet[E]) IterSubSets() iter.Seq[ds.MutableSet[E]]
- func (s *MutableHashableSet[E]) List() []E
- func (s *MutableHashableSet[E]) Remove(e E)
- func (s *MutableHashableSet[E]) RemoveAll(es ...E)
- func (s *MutableHashableSet[_]) Size() int
- func (s *MutableHashableSet[E]) SubSets() []ds.MutableSet[E]
- func (s *MutableHashableSet[E]) SymmetricDifference(other ds.MutableSet[E]) ds.MutableSet[E]
- func (s *MutableHashableSet[E]) Union(other ds.MutableSet[E]) ds.MutableSet[E]
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewComparable ¶
func NewComparable[E comparable](xs ...E) ds.MutableSet[E]
NewComparable creates a new mutable set for comparable element types.
func NewHashable ¶
func NewHashable[E ds.Hashable[E]](xs ...E) ds.MutableSet[E]
NewHashable creates a new mutable set for hashable element types.
Types ¶
type ConcurrentSet ¶
type ConcurrentSet[E any] struct { // contains filtered or unexported fields }
ConcurrentSet is a thread-safe wrapper around a MutableSet. All operations are protected by a read-write mutex.
func NewConcurrentSet ¶
func NewConcurrentSet[E any](innerSet ds.MutableSet[E]) *ConcurrentSet[E]
NewConcurrentSet creates a new thread-safe set wrapping the given mutable set.
func (*ConcurrentSet[E]) AddAll ¶
func (s *ConcurrentSet[E]) AddAll(es ...E)
AddAll adds multiple elements to the set.
func (*ConcurrentSet[_]) Cardinality ¶
func (s *ConcurrentSet[_]) Cardinality() int
Cardinality returns the number of elements in the set.
func (*ConcurrentSet[E]) Clear ¶
func (s *ConcurrentSet[E]) Clear()
Clear removes all elements from the set.
func (*ConcurrentSet[E]) Clone ¶
func (s *ConcurrentSet[E]) Clone() ds.ConcurrentSet[E]
Clone returns a new concurrent set with a copy of the data.
func (*ConcurrentSet[E]) Compute ¶
func (s *ConcurrentSet[E]) Compute(e E, remappingFunction func(e E, exists bool) (E, bool)) E
Compute atomically computes a new value based on the element's presence. The remappingFunction receives the element and whether it exists, returning the new value and whether to store it.
func (*ConcurrentSet[E]) ComputeIfAbsent ¶
func (s *ConcurrentSet[E]) ComputeIfAbsent(e E, mappingFunction func(e E) (E, bool)) E
ComputeIfAbsent atomically computes a value only if the element is absent. The mappingFunction returns the value to store and whether to store it. If the element exists, returns the element without calling mappingFunction.
func (*ConcurrentSet[E]) ComputeIfPresent ¶
func (s *ConcurrentSet[E]) ComputeIfPresent(e E, remappingFunction func(e E) (E, bool)) E
ComputeIfPresent atomically computes a new value only if the element is present. The remappingFunction returns the new value and whether to keep it (false removes the element). If the element is absent, returns the element without calling remappingFunction.
func (*ConcurrentSet[E]) Contains ¶
func (s *ConcurrentSet[E]) Contains(e E) bool
Contains returns true if the element is in the set.
func (*ConcurrentSet[E]) Difference ¶
func (s *ConcurrentSet[E]) Difference(other ds.Set[E]) ds.ConcurrentSet[E]
Difference returns a new concurrent set containing elements in this set but not in the other.
func (*ConcurrentSet[E]) Equal ¶
func (s *ConcurrentSet[E]) Equal(other ds.Set[E]) bool
Equal returns true if both sets contain exactly the same elements.
func (*ConcurrentSet[E]) Intersection ¶
func (s *ConcurrentSet[E]) Intersection(other ds.Set[E]) ds.ConcurrentSet[E]
Intersection returns a new concurrent set containing only elements present in both sets.
func (*ConcurrentSet[_]) IsEmpty ¶
func (s *ConcurrentSet[_]) IsEmpty() bool
IsEmpty returns true if the set contains no elements.
func (*ConcurrentSet[E]) IsProperSubSet ¶
func (s *ConcurrentSet[E]) IsProperSubSet(other ds.Set[E]) bool
IsProperSubSet returns true if this is a subset of other and they are not equal.
func (*ConcurrentSet[E]) IsProperSuperSet ¶
func (s *ConcurrentSet[E]) IsProperSuperSet(other ds.Set[E]) bool
IsProperSuperSet returns true if this is a superset of other and they are not equal.
func (*ConcurrentSet[E]) IsSubSet ¶
func (s *ConcurrentSet[E]) IsSubSet(other ds.Set[E]) bool
IsSubSet returns true if all elements of this set are in the other set.
func (*ConcurrentSet[E]) IsSuperSet ¶
func (s *ConcurrentSet[E]) IsSuperSet(other ds.Set[E]) bool
IsSuperSet returns true if all elements of the other set are in this set.
func (*ConcurrentSet[E]) Iter ¶
func (s *ConcurrentSet[E]) Iter() iter.Seq[E]
Iter returns an iterator over all elements in the set.
func (*ConcurrentSet[E]) Iter2 ¶
func (s *ConcurrentSet[E]) Iter2() iter.Seq2[int, E]
Iter2 returns an iterator with index and element pairs.
func (*ConcurrentSet[E]) IterSubSets ¶
func (s *ConcurrentSet[E]) IterSubSets() iter.Seq[ds.Set[E]]
IterSubSets returns an iterator over all possible subsets of this set.
func (*ConcurrentSet[E]) List ¶
func (s *ConcurrentSet[E]) List() []E
List returns a slice of all elements in the set.
func (*ConcurrentSet[E]) Remove ¶
func (s *ConcurrentSet[E]) Remove(e E)
Remove removes an element from the set.
func (*ConcurrentSet[E]) RemoveAll ¶
func (s *ConcurrentSet[E]) RemoveAll(es ...E)
RemoveAll removes multiple elements from the set.
func (*ConcurrentSet[_]) Size ¶
func (s *ConcurrentSet[_]) Size() int
Size returns the number of elements in the set.
func (*ConcurrentSet[E]) SubSets ¶
func (s *ConcurrentSet[E]) SubSets() []ds.Set[E]
SubSets returns all possible subsets of this set (power set).
func (*ConcurrentSet[E]) SymmetricDifference ¶
func (s *ConcurrentSet[E]) SymmetricDifference(other ds.Set[E]) ds.ConcurrentSet[E]
SymmetricDifference returns a new concurrent set containing elements in either set but not both.
func (*ConcurrentSet[E]) Union ¶
func (s *ConcurrentSet[E]) Union(other ds.Set[E]) ds.ConcurrentSet[E]
Union returns a new concurrent set containing all elements from both sets.
type ImmutableSet ¶
type ImmutableSet[E any] struct { // contains filtered or unexported fields }
ImmutableSet is an immutable wrapper around a MutableSet.
func (*ImmutableSet[E]) Cardinality ¶
func (s *ImmutableSet[E]) Cardinality() int
Cardinality returns the number of elements in the set.
func (*ImmutableSet[E]) Clone ¶
func (s *ImmutableSet[E]) Clone() ds.Set[E]
Clone returns a copy of this set.
func (*ImmutableSet[E]) Contains ¶
func (s *ImmutableSet[E]) Contains(e E) bool
Contains returns true if the element is in the set.
func (*ImmutableSet[E]) Difference ¶
func (s *ImmutableSet[E]) Difference(other ds.Set[E]) ds.Set[E]
Difference returns a new immutable set containing elements in this set but not in the other.
func (*ImmutableSet[E]) Equal ¶
func (s *ImmutableSet[E]) Equal(other ds.Set[E]) bool
Equal returns true if both sets contain exactly the same elements.
func (*ImmutableSet[E]) Intersection ¶
func (s *ImmutableSet[E]) Intersection(other ds.Set[E]) ds.Set[E]
Intersection returns a new immutable set containing only elements present in both sets.
func (*ImmutableSet[E]) IsEmpty ¶
func (s *ImmutableSet[E]) IsEmpty() bool
IsEmpty returns true if the set contains no elements.
func (*ImmutableSet[E]) IsProperSubSet ¶
func (s *ImmutableSet[E]) IsProperSubSet(of ds.Set[E]) bool
IsProperSubSet returns true if this is a subset of other and they are not equal.
func (*ImmutableSet[E]) IsProperSuperSet ¶
func (s *ImmutableSet[E]) IsProperSuperSet(of ds.Set[E]) bool
IsProperSuperSet returns true if this is a superset of other and they are not equal.
func (*ImmutableSet[E]) IsSubSet ¶
func (s *ImmutableSet[E]) IsSubSet(of ds.Set[E]) bool
IsSubSet returns true if all elements of this set are in the other set.
func (*ImmutableSet[E]) IsSuperSet ¶
func (s *ImmutableSet[E]) IsSuperSet(of ds.Set[E]) bool
IsSuperSet returns true if all elements of the other set are in this set.
func (*ImmutableSet[E]) Iter ¶
func (s *ImmutableSet[E]) Iter() iter.Seq[E]
Iter returns an iterator over all elements in the set.
func (*ImmutableSet[E]) Iter2 ¶
func (s *ImmutableSet[E]) Iter2() iter.Seq2[int, E]
Iter2 returns an iterator with index and element pairs.
func (*ImmutableSet[E]) IterSubSets ¶
func (s *ImmutableSet[E]) IterSubSets() iter.Seq[ds.Set[E]]
IterSubSets returns an iterator over all possible subsets of this set.
func (*ImmutableSet[E]) List ¶
func (s *ImmutableSet[E]) List() []E
List returns a slice of all elements in the set.
func (*ImmutableSet[E]) Size ¶
func (s *ImmutableSet[E]) Size() int
Size returns the number of elements in the set.
func (*ImmutableSet[E]) SubSets ¶
func (s *ImmutableSet[E]) SubSets() []ds.Set[E]
SubSets returns all possible subsets of this set (power set).
func (*ImmutableSet[E]) SymmetricDifference ¶
func (s *ImmutableSet[E]) SymmetricDifference(other ds.Set[E]) ds.Set[E]
SymmetricDifference returns a new immutable set containing elements in either set but not both.
func (*ImmutableSet[E]) Unfreeze ¶
func (s *ImmutableSet[E]) Unfreeze() ds.MutableSet[E]
Unfreeze returns a mutable copy of this set.
type MutableComparableSet ¶
type MutableComparableSet[E comparable] struct { // contains filtered or unexported fields }
MutableComparableSet is a mutable hash set for comparable element types.
func (*MutableComparableSet[E]) Add ¶
func (s *MutableComparableSet[E]) Add(e E)
Add adds an element to the set.
func (*MutableComparableSet[E]) AddAll ¶
func (s *MutableComparableSet[E]) AddAll(es ...E)
AddAll adds multiple elements to the set.
func (*MutableComparableSet[_]) Cardinality ¶
func (s *MutableComparableSet[_]) Cardinality() int
Cardinality returns the number of elements in the set.
func (*MutableComparableSet[E]) Clear ¶
func (s *MutableComparableSet[E]) Clear()
Clear removes all elements from the set.
func (*MutableComparableSet[E]) Clone ¶
func (s *MutableComparableSet[E]) Clone() ds.MutableSet[E]
Clone returns a mutable copy of this set.
func (*MutableComparableSet[E]) Contains ¶
func (s *MutableComparableSet[E]) Contains(e E) bool
Contains returns true if the element is in the set.
func (*MutableComparableSet[E]) Difference ¶
func (s *MutableComparableSet[E]) Difference(other ds.MutableSet[E]) ds.MutableSet[E]
Difference returns a new set containing elements in this set but not in the other.
func (*MutableComparableSet[E]) Equal ¶
func (s *MutableComparableSet[E]) Equal(other ds.MutableSet[E]) bool
Equal returns true if both sets contain exactly the same elements.
func (*MutableComparableSet[E]) Freeze ¶
func (s *MutableComparableSet[E]) Freeze() ds.Set[E]
Freeze returns an immutable snapshot of this set.
func (*MutableComparableSet[E]) Intersection ¶
func (s *MutableComparableSet[E]) Intersection(other ds.MutableSet[E]) ds.MutableSet[E]
Intersection returns a new set containing only elements present in both sets.
func (*MutableComparableSet[_]) IsEmpty ¶
func (s *MutableComparableSet[_]) IsEmpty() bool
IsEmpty returns true if the set contains no elements.
func (*MutableComparableSet[E]) IsProperSubSet ¶
func (s *MutableComparableSet[E]) IsProperSubSet(of ds.MutableSet[E]) bool
IsProperSubSet returns true if this is a subset of other and they are not equal.
func (*MutableComparableSet[E]) IsProperSuperSet ¶
func (s *MutableComparableSet[E]) IsProperSuperSet(of ds.MutableSet[E]) bool
IsProperSuperSet returns true if this is a superset of other and they are not equal.
func (*MutableComparableSet[E]) IsSubSet ¶
func (s *MutableComparableSet[E]) IsSubSet(of ds.MutableSet[E]) bool
IsSubSet returns true if all elements of this set are in the other set.
func (*MutableComparableSet[E]) IsSuperSet ¶
func (s *MutableComparableSet[E]) IsSuperSet(of ds.MutableSet[E]) bool
IsSuperSet returns true if all elements of the other set are in this set.
func (*MutableComparableSet[E]) Iter ¶
func (s *MutableComparableSet[E]) Iter() iter.Seq[E]
Iter returns an iterator over all elements in the set.
func (*MutableComparableSet[E]) Iter2 ¶
func (s *MutableComparableSet[E]) Iter2() iter.Seq2[int, E]
Iter2 returns an iterator with index and element pairs.
func (*MutableComparableSet[E]) IterSubSets ¶
func (s *MutableComparableSet[E]) IterSubSets() iter.Seq[ds.MutableSet[E]]
IterSubSets returns an iterator over all possible subsets of this set.
func (*MutableComparableSet[E]) List ¶
func (s *MutableComparableSet[E]) List() []E
List returns a slice of all elements in the set.
func (*MutableComparableSet[E]) Remove ¶
func (s *MutableComparableSet[E]) Remove(e E)
Remove removes an element from the set.
func (*MutableComparableSet[E]) RemoveAll ¶
func (s *MutableComparableSet[E]) RemoveAll(es ...E)
RemoveAll removes multiple elements from the set.
func (*MutableComparableSet[_]) Size ¶
func (s *MutableComparableSet[_]) Size() int
Size returns the number of elements in the set.
func (*MutableComparableSet[E]) SubSets ¶
func (s *MutableComparableSet[E]) SubSets() []ds.MutableSet[E]
SubSets returns all possible subsets of this set (power set).
func (*MutableComparableSet[E]) SymmetricDifference ¶
func (s *MutableComparableSet[E]) SymmetricDifference(other ds.MutableSet[E]) ds.MutableSet[E]
SymmetricDifference returns a new set containing elements in either set but not both.
func (*MutableComparableSet[E]) Union ¶
func (s *MutableComparableSet[E]) Union(other ds.MutableSet[E]) ds.MutableSet[E]
Union returns a new set containing all elements from both sets.
type MutableHashableSet ¶
MutableHashableSet is a mutable hash set for hashable element types.
func (*MutableHashableSet[E]) Add ¶
func (s *MutableHashableSet[E]) Add(e E)
Add adds an element to the set.
func (*MutableHashableSet[E]) AddAll ¶
func (s *MutableHashableSet[E]) AddAll(es ...E)
AddAll adds multiple elements to the set.
func (*MutableHashableSet[_]) Cardinality ¶
func (s *MutableHashableSet[_]) Cardinality() int
Cardinality returns the number of elements in the set.
func (*MutableHashableSet[E]) Clear ¶
func (s *MutableHashableSet[E]) Clear()
Clear removes all elements from the set.
func (*MutableHashableSet[E]) Clone ¶
func (s *MutableHashableSet[E]) Clone() ds.MutableSet[E]
Clone returns a mutable copy of this set.
func (*MutableHashableSet[E]) Contains ¶
func (s *MutableHashableSet[E]) Contains(e E) bool
Contains returns true if the element is in the set.
func (*MutableHashableSet[E]) Difference ¶
func (s *MutableHashableSet[E]) Difference(other ds.MutableSet[E]) ds.MutableSet[E]
Difference returns a new set containing elements in this set but not in the other.
func (*MutableHashableSet[E]) Equal ¶
func (s *MutableHashableSet[E]) Equal(other ds.MutableSet[E]) bool
Equal returns true if both sets contain exactly the same elements.
func (*MutableHashableSet[E]) Freeze ¶
func (s *MutableHashableSet[E]) Freeze() ds.Set[E]
Freeze returns an immutable snapshot of this set.
func (*MutableHashableSet[E]) HashCode ¶
func (s *MutableHashableSet[E]) HashCode() base.HashCode
HashCode computes and returns the hash code for this set. The hash code is computed by XORing the hash codes of all elements.
func (*MutableHashableSet[E]) Intersection ¶
func (s *MutableHashableSet[E]) Intersection(other ds.MutableSet[E]) ds.MutableSet[E]
Intersection returns a new set containing only elements present in both sets.
func (*MutableHashableSet[_]) IsEmpty ¶
func (s *MutableHashableSet[_]) IsEmpty() bool
IsEmpty returns true if the set contains no elements.
func (*MutableHashableSet[E]) IsProperSubSet ¶
func (s *MutableHashableSet[E]) IsProperSubSet(of ds.MutableSet[E]) bool
IsProperSubSet returns true if this is a subset of other and they are not equal.
func (*MutableHashableSet[E]) IsProperSuperSet ¶
func (s *MutableHashableSet[E]) IsProperSuperSet(of ds.MutableSet[E]) bool
IsProperSuperSet returns true if this is a superset of other and they are not equal.
func (*MutableHashableSet[E]) IsSubSet ¶
func (s *MutableHashableSet[E]) IsSubSet(of ds.MutableSet[E]) bool
IsSubSet returns true if all elements of this set are in the other set.
func (*MutableHashableSet[E]) IsSuperSet ¶
func (s *MutableHashableSet[E]) IsSuperSet(of ds.MutableSet[E]) bool
IsSuperSet returns true if all elements of the other set are in this set.
func (*MutableHashableSet[E]) Iter ¶
func (s *MutableHashableSet[E]) Iter() iter.Seq[E]
Iter returns an iterator over all elements in the set.
func (*MutableHashableSet[E]) Iter2 ¶
func (s *MutableHashableSet[E]) Iter2() iter.Seq2[int, E]
Iter2 returns an iterator with index and element pairs.
func (*MutableHashableSet[E]) IterSubSets ¶
func (s *MutableHashableSet[E]) IterSubSets() iter.Seq[ds.MutableSet[E]]
IterSubSets returns an iterator over all possible subsets of this set.
func (*MutableHashableSet[E]) List ¶
func (s *MutableHashableSet[E]) List() []E
List returns a slice of all elements in the set.
func (*MutableHashableSet[E]) Remove ¶
func (s *MutableHashableSet[E]) Remove(e E)
Remove removes an element from the set.
func (*MutableHashableSet[E]) RemoveAll ¶
func (s *MutableHashableSet[E]) RemoveAll(es ...E)
RemoveAll removes multiple elements from the set.
func (*MutableHashableSet[_]) Size ¶
func (s *MutableHashableSet[_]) Size() int
Size returns the number of elements in the set.
func (*MutableHashableSet[E]) SubSets ¶
func (s *MutableHashableSet[E]) SubSets() []ds.MutableSet[E]
SubSets returns all possible subsets of this set (power set).
func (*MutableHashableSet[E]) SymmetricDifference ¶
func (s *MutableHashableSet[E]) SymmetricDifference(other ds.MutableSet[E]) ds.MutableSet[E]
SymmetricDifference returns a new set containing elements in either set but not both.
func (*MutableHashableSet[E]) Union ¶
func (s *MutableHashableSet[E]) Union(other ds.MutableSet[E]) ds.MutableSet[E]
Union returns a new set containing all elements from both sets.