Documentation ¶
Index ¶
- type Set
- func Difference(set1 *Set, sets ...strset.Set) *Set
- func DifferenceThreadsafe(set1 *Set, sets ...*Set) *Set
- func FromSlice(items []string) *Set
- func Intersection(set1 *Set, sets ...strset.Set) *Set
- func IntersectionThreadsafe(set1 *Set, sets ...*Set) *Set
- func New(ts ...string) *Set
- func NewWithSize(size int) *Set
- func SymmetricDifferenceThreadsafe(s *Set, t *Set) *Set
- func Union(set1 *Set, sets ...strset.Set) *Set
- func UnionThreadsafe(sets ...*Set) *Set
- func (s *Set) Add(items ...string)
- func (s *Set) Clear()
- func (s *Set) Copy() strset.Set
- func (s *Set) CopyToThreadsafe() *Set
- func (s *Set) GetOne() string
- func (s *Set) GetOne2() (string, bool)
- func (s *Set) Has(items ...string) bool
- func (s *Set) HasAny(items ...string) bool
- func (s *Set) IsEqual(t strset.Set) bool
- func (s *Set) IsEqualThreadsafe(t *Set) bool
- func (s *Set) IsSubset(t strset.Set) bool
- func (s *Set) IsSubsetThreadsafe(t *Set) bool
- func (s *Set) IsSuperset(t strset.Set) bool
- func (s *Set) IsSupersetThreadsafe(t *Set) bool
- func (s *Set) Len() int
- func (s *Set) Merge(sets ...strset.Set)
- func (s *Set) MergeThreadsafe(sets ...*Set)
- func (s *Set) Pop() string
- func (s *Set) Pop2() (string, bool)
- func (s *Set) Remove(items ...string)
- func (s *Set) Shrink(targetLen int)
- func (s *Set) ShrinkSorted(targetLen int)
- func (s *Set) Slice() []string
- func (s *Set) SliceSorted() []string
- func (s *Set) String() string
- func (s *Set) Subtract(sets ...strset.Set)
- func (s *Set) SubtractThreadsafe(sets ...*Set)
- func (s *Set) ToStrset() strset.Set
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Set ¶
New creates and initializes a new Set.
func Difference ¶
Difference returns a new set which contains items which are in the first set but not in the others.
func DifferenceThreadsafe ¶
DifferenceThreadsafe returns a new set which contains items which are in in the first set but not in the others.
func Intersection ¶
Intersection returns a new set which contains items that only exist in all given sets.
func IntersectionThreadsafe ¶
IntersectionThreadsafe returns a new set which contains items that only exist in all given sets.
func NewWithSize ¶
NewWithSize creates a new Set and gives make map a size hint.
func SymmetricDifferenceThreadsafe ¶
SymmetricDifferenceThreadsafe returns a new set which s is the difference of items which are in one of either, but not in both.
func Union ¶
Union is the merger of multiple sets. It returns a new set with all the elements present in all the sets that are passed.
func UnionThreadsafe ¶
UnionThreadsafe is the merger of multiple sets. It returns a new set with all the elements present in all the sets that are passed.
func (*Set) Add ¶
Add includes the specified items (one or more) to the Set. The underlying Set s is modified. If passed nothing it silently returns.
func (*Set) CopyToThreadsafe ¶
CopyToThreadsafe returns a new Set with a copy of s.
func (*Set) GetOne2 ¶
GetOne2 returns an item from the set. The second value is a bool that is true if an item exists in the set, or false if the set is empty.
func (*Set) Has ¶
Has looks for the existence of items passed. It returns false if nothing is passed. For multiple items it returns true only if all of the items exist.
func (*Set) HasAny ¶
HasAny looks for the existence of any of the items passed. It returns false if nothing is passed. For multiple items it returns true if any of the items exist.
func (*Set) IsEqualThreadsafe ¶
IsEqualThreadsafe test whether s and t are the same in size and have the same items.
func (*Set) IsSubsetThreadsafe ¶
IsSubsetThreadsafe tests whether t is a subset of s.
func (*Set) IsSuperset ¶
IsSuperset tests whether t is a superset of s.
func (*Set) IsSupersetThreadsafe ¶
IsSupersetThreadsafe tests whether t is a superset of s.
func (*Set) Merge ¶
Merge is like Union, however it modifies the current Set it's applied on with the given t Set.
func (*Set) MergeThreadsafe ¶
MergeThreadsafe is like UnionThreadsafe, however it modifies the current Set it's applied on with the given t Set.
func (*Set) Pop ¶
Pop deletes and returns an item from the Set. The underlying Set s is modified. If Set is empty, the zero value is returned.
func (*Set) Pop2 ¶
Pop2 tries to delete and return an item from the Set. The underlying Set s is modified. The second value is a bool that is true if the item existed in the set, and false if not. If Set is empty, the zero value and false are returned.
func (*Set) Remove ¶
Remove deletes the specified items from the Set. The underlying Set s is modified. If passed nothing it silently returns.
func (*Set) ShrinkSorted ¶
remove items alphabetically until len(s) <= targetLen
func (*Set) SliceSorted ¶
List returns a sorted slice of all items (a to z).
func (*Set) SubtractThreadsafe ¶
SubtractThreadsafe removes the Set items contained in sets from Set s