Documentation ¶
Overview ¶
Implementation of a Set container
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Set ¶
type Set interface { // Returns a new empty Set of the same type. New() Set // Returns a new Set that contains exactly the same elements as this set. Copy() Set // Returns the cardinality of this set. Len() int // Returns true if and only if this set contains v (according to Go equality rules). Contains(v interface{}) bool // Inserts v into this set. Add(v interface{}) // Removes v from this set, if it is present. Returns true if and only if v was present. Remove(v interface{}) bool // Executes f(v) for every element v in this set. If f mutates this set, behavior is undefined. Do(f func(interface{})) // Executes f(v) once for every element v in the set, aborting if f ever returns false. If f // mutates this set, behavior is undefined. DoWhile(f func(interface{}) bool) // Returns a channel from which each element in the set can be read exactly once. If this set // is mutated before the channel is emptied, the exact data read from the channel is undefined. Iter() <-chan interface{} // Adds every element in s into this set. Union(s Set) // Removes every element not in s from this set. Intersect(s Set) // Removes every element in s from this set. Subtract(s Set) // Removes all elements from the set. Init() // Returns true if and only if all elements in this set are elements in s. IsSubset(s Set) bool // Returns true if and only if all elements in s are elements in this set. IsSuperset(s Set) bool // Returns true if and only if this set and s contain exactly the same elements. IsEqual(s Set) bool // Removes all elements v from this set that satisfy f(v) == true. RemoveIf(f func(interface{}) bool) }
An unordered collection of unique elements which supports lookups, insertions, deletions, iteration, and common binary set operations. It is not guaranteed to be thread-safe.
func NewKeyedSet ¶
func NewKeyedSet(keyf func(interface{}) interface{}, items ...interface{}) Set
Returns a new Set pre-populated with the given items
func NewSet ¶
func NewSet(items ...interface{}) Set
Returns a new Set pre-populated with the given items
Click to show internal directories.
Click to hide internal directories.