Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Set ¶
type Set[Value comparable] struct { // contains filtered or unexported fields }
Set is a data structure that contains unique values. This data structure is not safe for concurrent accesses.
func SetFromSlice ¶
func SetFromSlice[Value comparable](slice []Value) *Set[Value]
SetFromSlice creates a new set that is prepopulated with the values from the given slice. The slice values will be deduplicated. This can be more efficient than manually creating and populating the set with values as the underlying data structure will already be preallocated.
func SetFromValues ¶
func SetFromValues[Value comparable](values ...Value) *Set[Value]
SetFromValues creates a new set that is populated with the provided values. The values will be deduplicated. This can be more efficient than manually creating and populating the set with values as the underlying data structure will already be preallocated.
func (*Set[Value]) Add ¶
Add adds the given value to the set. Returns `true` if the value was added, and `false` in case no change was made to the set.
func (*Set[Value]) Equal ¶
Equal determines whether the set is equal to another set. Two sets are equal when they contain the exact same values.