Documentation
¶
Index ¶
- type OrderedSet
- func (s *OrderedSet[T]) Add(elems ...T)
- func (s *OrderedSet[T]) Contains(e T) bool
- func (s *OrderedSet[T]) Count() int
- func (s *OrderedSet[T]) Diff(other *OrderedSet[T]) *OrderedSet[T]
- func (s *OrderedSet[T]) Intersection(other *OrderedSet[T]) *OrderedSet[T]
- func (s *OrderedSet[T]) IsEmpty() bool
- func (s *OrderedSet[T]) IsEqual(other *OrderedSet[T]) bool
- func (s *OrderedSet[T]) Remove(elems ...T)
- func (s OrderedSet[T]) String() string
- func (s *OrderedSet[T]) ToList() []T
- func (s *OrderedSet[T]) Union(other *OrderedSet[T]) *OrderedSet[T]
- type Set
- func (s *Set[T]) Add(elems ...T)
- func (s *Set[T]) Contains(e T) bool
- func (s *Set[T]) Count() int
- func (s *Set[T]) Diff(other *Set[T]) *Set[T]
- func (s *Set[T]) Intersection(other *Set[T]) *Set[T]
- func (s *Set[T]) IsEmpty() bool
- func (s *Set[T]) IsEqual(other *Set[T]) bool
- func (s *Set[T]) Remove(elems ...T)
- func (s Set[T]) String() string
- func (s *Set[T]) ToList() []T
- func (s *Set[T]) Union(other *Set[T]) *Set[T]
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type OrderedSet ¶
type OrderedSet[T comparable] struct { Elems []T `json:"set_elems"` EMap map[T]bool `json:"set_e_map"` }
func NewOrdered ¶
func NewOrdered[T comparable](elems ...T) *OrderedSet[T]
func (*OrderedSet[T]) Add ¶
func (s *OrderedSet[T]) Add(elems ...T)
Add one or more elements to the set
func (*OrderedSet[T]) Contains ¶
func (s *OrderedSet[T]) Contains(e T) bool
func (*OrderedSet[T]) Count ¶
func (s *OrderedSet[T]) Count() int
Count returns the number of elements in the set
func (*OrderedSet[T]) Diff ¶
func (s *OrderedSet[T]) Diff(other *OrderedSet[T]) *OrderedSet[T]
Diff returns a new set with elements in this set, but not in the other set
func (*OrderedSet[T]) Intersection ¶
func (s *OrderedSet[T]) Intersection(other *OrderedSet[T]) *OrderedSet[T]
Intersection returns a new set that has common elements present in both sets
func (*OrderedSet[T]) IsEmpty ¶
func (s *OrderedSet[T]) IsEmpty() bool
func (*OrderedSet[T]) IsEqual ¶
func (s *OrderedSet[T]) IsEqual(other *OrderedSet[T]) bool
Equals returns true if every element is same between this and the other set, and in the same order
func (*OrderedSet[T]) Remove ¶
func (s *OrderedSet[T]) Remove(elems ...T)
Remove the given elements from the current set
func (OrderedSet[T]) String ¶
func (s OrderedSet[T]) String() string
func (*OrderedSet[T]) ToList ¶
func (s *OrderedSet[T]) ToList() []T
func (*OrderedSet[T]) Union ¶
func (s *OrderedSet[T]) Union(other *OrderedSet[T]) *OrderedSet[T]
Union returns a new set that has all elements from both sets
type Set ¶
type Set[T comparable] struct { EMap map[T]bool `json:"set_e_map"` }
func New ¶
func New[T comparable](elems ...T) *Set[T]
func (*Set[T]) Intersection ¶
Intersection returns a new set that has common elements present in both sets
func (*Set[T]) IsEqual ¶
Equals returns true if every element is same between this and the other set
Click to show internal directories.
Click to hide internal directories.