Documentation
¶
Overview ¶
Package set provides OOP-style sets.
For better performance, all functions in this package and its subpackages are unsafe for concurrency unless otherwise specified.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Set ¶
type Set[Item any] interface { container.Container[Item] container.Filter[Item] // ContainsItem reports whether the item x is in the set. ContainsItem(x Item) bool // ContainsSet reports whether the set s is a subset of this set. ContainsSet(s Set[Item]) bool // ContainsAny reports whether any item in c is in this set. // // If c is nil or empty, it returns false. ContainsAny(c container.Container[Item]) bool // Add adds x to the set. Add(x ...Item) // Remove removes x from the set. // // It does nothing for the items in x that are not in the set. Remove(x ...Item) // Union adds the items in s to this set. // That is, perform the following assignment: // // thisSet = thisSet ∪ s Union(s Set[Item]) // Intersect removes the items not in s. // That is, perform the following assignment: // // thisSet = thisSet ∩ s Intersect(s Set[Item]) // Subtract removes the items in s. // That is, perform the following assignment: // // thisSet = thisSet \ s Subtract(s Set[Item]) // DisjunctiveUnion removes the items both in s and this set and // adds the items only in s. // That is, perform the following assignment: // // thisSet = thisSet △ s DisjunctiveUnion(s Set[Item]) // Clear removes all items in the set and asks to release the memory. Clear() }
Set is an interface representing a set.
Set guarantees to contain no duplicate items.
Click to show internal directories.
Click to hide internal directories.