Documentation ¶
Overview ¶
Package set defines the interface for set collections. Sets are collections of distinct values. Sub-packages contain implementations.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Set ¶
type Set[T any] interface { // Set implements Collection collections.Collection[T] // Get returns the collection element that matches the given value, or nil if it is not found. // Useful if the set contains struct elements you want to modify in-place. Get(value T) collections.Element[T] // Difference returns the difference between two sets. // // The new set consists of a shallow-copy of all elements that are in this set, but not other set. Difference(Set[T]) Set[T] // Intersection returns the intersection between two sets. // // The new set consists of a shallow-copy of all elements that are in both this set and the other. Intersection(Set[T]) Set[T] // Union returns the union of two sets. // // The new set consists of a shallow-copy of all elements that are in both this and the other set. Union(Set[T]) Set[T] // Tests whether the given value is contained within the set. // // Not indended to be used by client programs as it never takes a lock, even when thread safety // is enabled. Used to speed up the above set operations. UnlockedContains(T) bool // Prevent external implementations of this interface local.InternalInter }
Set is the abstract interface for collections of unique elements.
Implemented by HashSet[T], OrderedSet[T].
Directories ¶
Path | Synopsis |
---|---|
Package hashset provides a hash bucket backed collection that contains an unordered collection of unique values.
|
Package hashset provides a hash bucket backed collection that contains an unordered collection of unique values. |
Package orderedset provides a red-black tree backed ordered collection of unique items.
|
Package orderedset provides a red-black tree backed ordered collection of unique items. |
Click to show internal directories.
Click to hide internal directories.