Documentation ¶
Overview ¶
Package set provides standard set classes and functionality
Index ¶
- func Unique(strs []string) []string
- type ByteSet
- type StrSet
- func (s *StrSet) Add(items ...string)
- func (s *StrSet) AsSlice() []string
- func (s *StrSet) AsSortedSlice() []string
- func (s *StrSet) Contains(item string) bool
- func (s *StrSet) ContainsAll(items []string) bool
- func (s *StrSet) Equals(other *StrSet) bool
- func (s *StrSet) Iterate(callBack func(string) (cont bool))
- func (s *StrSet) JoinStrings(sep string) string
- func (s *StrSet) LeftIntersectionRight(other *StrSet) (left *StrSet, intersection *StrSet, right *StrSet)
- func (s *StrSet) Remove(items ...string)
- func (s *StrSet) Size() int
- type Uint64Set
- func (us *Uint64Set) Add(vals ...uint64)
- func (us *Uint64Set) AsSlice() []uint64
- func (us *Uint64Set) Contains(i uint64) bool
- func (us *Uint64Set) ContainsAll(uints []uint64) bool
- func (us *Uint64Set) Intersection(other *Uint64Set) *Uint64Set
- func (us *Uint64Set) Iter(fn func(uint64))
- func (us *Uint64Set) Remove(i uint64)
- func (us *Uint64Set) Size() int
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type ByteSet ¶
type ByteSet struct {
// contains filtered or unexported fields
}
func NewByteSet ¶
func (*ByteSet) ContainsAll ¶
type StrSet ¶
type StrSet struct {
// contains filtered or unexported fields
}
StrSet is a simple set implementation providing standard set operations for strings.
func (*StrSet) AsSlice ¶
AsSlice converts the set to a slice of strings. If this is an insensitive set the resulting slice will be lowercase regardless of the case that was used when adding the string to the set.
func (*StrSet) AsSortedSlice ¶
AsSortedSlice converts the set to a slice of strings. If this is an insensitive set the resulting slice will be lowercase regardless of the case that was used when adding the string to the set. The slice is sorted in ascending order.
func (*StrSet) ContainsAll ¶
ContainsAll returns true if all the items being checked are already in the set.
func (*StrSet) Iterate ¶
Iterate accepts a callback which will be called once for each element in the set until all items have been exhausted or callback returns false.
func (*StrSet) JoinStrings ¶
JoinStrings returns the sorted values from the set concatenated with a given sep
func (*StrSet) LeftIntersectionRight ¶
func (s *StrSet) LeftIntersectionRight(other *StrSet) (left *StrSet, intersection *StrSet, right *StrSet)
LeftIntersectionRight takes a slice of strings and returns a slice of strings containing the intersection with the set, and a slice of strings for the ones missing from the set.
type Uint64Set ¶
type Uint64Set struct {
// contains filtered or unexported fields
}