Documentation
¶
Overview ¶
Package lookup provides utilities for checking for the presence of a value.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Lookup ¶
type Lookup[T comparable] interface { // Has returns true if the value exists in the lookup. Has(value T) bool // Add adds a value to the lookup, and returns true if it already existed. Add(value T) bool // Remove removes a matching value from the lookup if it exists. It returns true if // the value was found. Remove(value T) bool // Len gets the length of the collection. Len() int // Iter produces an iterator over all the values in the lookup. Iter() iter.Seq[T] }
Lookup is a type that can check for the presence of a value.
func New ¶
func New[T comparable](threshold int, elements []T) Lookup[T]
New creates a new Lookup. The threshold is compared to the number of elements passed to determine how the elements will be stored.
Click to show internal directories.
Click to hide internal directories.