Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewSlice ¶
func NewSlice[T any](collection Collection[T]) []T
NewSlice creates a new slice from a collection.
Types ¶
type Collection ¶
func Map ¶
func Map[TFrom, TTo any](c Collection[TFrom], f func(TFrom) TTo) Collection[TTo]
Map maps all the values in a collection to a new collection.
type Deque ¶
type Deque[T any] interface { Clear() PeekBack() (value T, ok bool) PeekFront() (value T, ok bool) PopBack() (value T, ok bool) PopFront() (value T, ok bool) PushBack(value T) PushFront(value T) Size() int }
A Deque is a double-ended queue.
type Dictionary ¶
type Dictionary[TKey, TValue any] interface { Clear() Delete(key TKey) ForEach(callback func(Pair[TKey, TValue]) bool) Get(key TKey) (value TValue, ok bool) Keys() Collection[TKey] Set(key TKey, value TValue) Size() int Values() Collection[TValue] }
A Dictionary is a collection of key value pairs.
func NewDictionary ¶
func NewDictionary[TKey comparable, TValue any]() Dictionary[TKey, TValue]
NewDictionary creates a new Dictionary implemented using a map.
func NewSortedDictionary ¶
NewSortedDictionary creates a new Dictionary implemented using a btree, providing sorted iteration by the less function.
type Queue ¶
type Queue[T any] interface { Clear() Peek() (value T, ok bool) Pop() (value T, ok bool) Push(value T) Size() int }
A Queue is a collection that supports FIFO operations.
type Set ¶
type Set[T any] interface { Add(value T) Clear() Delete(value T) ForEach(callback func(T) bool) Has(value T) bool Size() int }
A Set is a unique collection of values.
func NewSortedSet ¶
NewSortedSet creates a new Set implemented using a btree, providing sorted iteration by the less function.
Click to show internal directories.
Click to hide internal directories.