Documentation ¶
Index ¶
- type Set
- func (s *Set) Add(items ...uint16)
- func (s *Set) Clear()
- func (s *Set) Copy() *Set
- func (s *Set) Each(f func(item uint16) bool)
- func (s *Set) Has(items ...uint16) bool
- func (s *Set) IsEmpty() bool
- func (s *Set) IsEqual(t *Set) bool
- func (s *Set) IsSubset(t *Set) bool
- func (s *Set) IsSuperset(t *Set) bool
- func (s *Set) List() []uint16
- func (s *Set) Merge(t *Set)
- func (s *Set) Pop() uint16
- func (s *Set) Remove(items ...uint16)
- func (s *Set) Separate(t *Set)
- func (s *Set) Size() int
- func (s *Set) String() string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Set ¶
type Set struct {
// contains filtered or unexported fields
}
Set is the main set structure that holds all the data and methods used to working with the set.
func Difference ¶
Difference 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 SymmetricDifference ¶
SymmetricDifference 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 (*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) Each ¶
Each traverses the items in the Set, calling the provided function for each Set member. Traversal will continue until all items in the Set have been visited, or if the closure returns false.
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) IsSuperset ¶
IsSuperset tests whether t is a superset of s.
func (*Set) List ¶
List returns a slice of all items. There is also StringSlice() and IntSlice() methods for returning slices of type string or int.
func (*Set) Merge ¶
Merge is like Union, however it modifies the current Set it's applied on with the given t Set.
func (*Set) Pop ¶
Pop deletes and return an item from the Set. The underlying Set s is modified. If Set is empty, nil is returned.
func (*Set) Remove ¶
Remove deletes the specified items from the Set. The underlying Set s is modified. If passed nothing it silently returns.