Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Set ¶
Set is an immutable set optimized for *small number of items*. For general purposes, Sets is likely better
*Set construction*: sets is roughly 1kb allocations per 250 items. smallsets is 0. *Contains* sets is O(1). smallsets is O(logn). smallsets is typically faster up to about 5 elements.
At 1000 items, it is roughly 5x slower (30ns vs 5ns).
func NewPresorted ¶
NewPresorted creates a new Set with the given items. If items is not sorted or contains duplicates, this gives undefined behavior; use New instead.
func (Set[T]) CopyAndInsert ¶
CopyAndInsert builds a *new* with all the current items plus new items
func (Set[T]) IsNil ¶
IsNil indicates whether the set is nil. This is different from an empty set. 'var smallset.Set': nil smallset.New(): nil smallset.New(emptyList...): not nil