Documentation
¶
Index ¶
- type Iterator
- type Set
- func (set Set[T]) Add(s ...T)
- func (set Set[T]) Cardinality() int
- func (set Set[T]) CheckAndAdd(i T) bool
- func (set *Set[T]) Clear()
- func (set Set[T]) Clone() Set[T]
- func (set Set[T]) Contains(i ...T) bool
- func (set Set[T]) Difference(other Set[T]) Set[T]
- func (set Set[T]) Equals(other Set[T]) bool
- func (set Set[T]) HasOverlap(other Set[T]) bool
- func (set Set[T]) Intersect(other Set[T]) Set[T]
- func (set Set[T]) IsEmpty() bool
- func (set Set[T]) IsSubset(other Set[T]) bool
- func (set Set[T]) IsSuperset(other Set[T]) bool
- func (set Set[T]) Iter() <-chan T
- func (set Set[T]) Iterator() *Iterator[T]
- func (set Set[T]) MarshalJSON() ([]byte, error)
- func (set Set[T]) Merge(others ...Set[T])
- func (set Set[T]) Remove(i T)
- func (set Set[T]) String() string
- func (set Set[T]) SymmetricDifference(other Set[T]) Set[T]
- func (set Set[T]) ToSlice() []T
- func (set Set[T]) Union(other ...Set[T]) Set[T]
- func (set *Set[T]) UnmarshalJSON(b []byte) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Iterator ¶
type Iterator[T comparable] struct { C <-chan T // contains filtered or unexported fields }
Iterator defines an iterator over a Set, its C channel can be used to range over the Set's elements.
type Set ¶
type Set[T comparable] map[T]struct{}
func (Set[T]) Cardinality ¶
func (Set[T]) CheckAndAdd ¶
CheckAndAdd check if exists and add
func (Set[T]) Difference ¶
func (Set[T]) HasOverlap ¶
func (Set[T]) IsSuperset ¶
func (Set[T]) MarshalJSON ¶
MarshalJSON creates a JSON array from the set, it marshals all elements
func (Set[T]) SymmetricDifference ¶
func (*Set[T]) UnmarshalJSON ¶
UnmarshalJSON recreates a set from a JSON array, it only decodes primitive types. Numbers are decoded as json.Number.
Click to show internal directories.
Click to hide internal directories.