Versions in this module Expand all Collapse all v2 v2.0.0 Jul 3, 2025 Changes in this version + const DirectoryOptionsExcludeDirectories + const DirectoryOptionsExcludeFiles + const DirectoryOptionsRecursive + var ErrUnexpectedType = errors.New("value was of an unexpected type") + func All[T any](subject Enumerable[T], p Predicate[T]) bool + func Any[T any](iterator Enumerable[T]) bool + func Anyp[T any](iterator Enumerable[T], p Predicate[T]) bool + func CountAll[T any](iter Enumerable[T]) int + func Count[T any](iter Enumerable[T], p Predicate[T]) int + func ElementAt[T any](iter Enumerable[T], n uint) T + func First[T any](subject Enumerable[T]) (retval T, err error) + func IsErrorMultipleElements(err error) bool + func IsErrorNoElements(err error) bool + func Last[T any](iter Enumerable[T]) T + func Single[T any](iter Enumerable[T]) (retval T, err error) + func Singlep[T any](iter Enumerable[T], pred Predicate[T]) (retval T, err error) + func ToSlice[T any](iter Enumerable[T]) []T + func UCountAll[T any](iter Enumerable[T]) uint + func UCount[T any](iter Enumerable[T], p Predicate[T]) uint + type Comparator func(a, b T) (int, error) + type Dictionary struct + func (dict *Dictionary) Add(word string) (wasAdded bool) + func (dict *Dictionary) Clear() + func (dict *Dictionary) Remove(word string) (wasRemoved bool) + func (dict Dictionary) Contains(word string) bool + func (dict Dictionary) Enumerate(ctx context.Context) Enumerator[string] + func (dict Dictionary) Size() int64 + type Directory struct + Location string + Options DirectoryOptions + func (d Directory) Enumerate(ctx context.Context) Enumerator[string] + type DirectoryOptions uint + type Enumerable interface + Enumerate func(ctx context.Context) Enumerator[T] + var Fibonacci Enumerable[uint] = fibonacciGenerator{} + func AsEnumerable[T any](entries ...T) Enumerable[T] + func Empty[T any]() Enumerable[T] + func Merge[T any](channels ...Enumerable[T]) Enumerable[T] + func ParallelSelect[T any, E any](original Enumerable[T], operation Transform[T, E]) Enumerable[E] + func Reverse[T any](original Enumerable[T]) Enumerable[T] + func SelectMany[T any, E any](subject Enumerable[T], toMany Unfolder[T, E]) Enumerable[E] + func Select[T any, E any](subject Enumerable[T], transform Transform[T, E]) Enumerable[E] + func Skip[T any](subject Enumerable[T], n uint) Enumerable[T] + func TakeWhile[T any](subject Enumerable[T], criteria func(T, uint) bool) Enumerable[T] + func Take[T any](subject Enumerable[T], n uint) Enumerable[T] + func Where[T any](original Enumerable[T], p Predicate[T]) Enumerable[T] + type EnumerableSlice []T + func (f EnumerableSlice[T]) Enumerate(ctx context.Context) Enumerator[T] + type Enumerator <-chan T + func (iter Enumerator[T]) All(p Predicate[T]) bool + func (iter Enumerator[T]) AsEnumerable() Enumerable[T] + func (iter Enumerator[T]) Count(p Predicate[T]) int + func (iter Enumerator[T]) CountAll() int + func (iter Enumerator[T]) Discard() + func (iter Enumerator[T]) ElementAt(n uint) T + func (iter Enumerator[T]) Last() (retval T) + func (iter Enumerator[T]) Merge(others ...Enumerator[T]) Enumerator[T] + func (iter Enumerator[T]) Reverse() Enumerator[T] + func (iter Enumerator[T]) Skip(n uint) Enumerator[T] + func (iter Enumerator[T]) Take(n uint) Enumerator[T] + func (iter Enumerator[T]) TakeWhile(criteria func(T, uint) bool) Enumerator[T] + func (iter Enumerator[T]) Tee() (Enumerator[T], Enumerator[T]) + func (iter Enumerator[T]) ToSlice() []T + func (iter Enumerator[T]) UCount(p Predicate[T]) uint + func (iter Enumerator[T]) UCountAll() uint + func (iter Enumerator[T]) Where(predicate Predicate[T]) Enumerator[T] + type LRUCache struct + func NewLRUCache[K comparable, V any](capacity uint) *LRUCache[K, V] + func (lru *LRUCache[K, V]) Enumerate(ctx context.Context) Enumerator[V] + func (lru *LRUCache[K, V]) EnumerateKeys(ctx context.Context) Enumerator[K] + func (lru *LRUCache[K, V]) Get(key K) (V, bool) + func (lru *LRUCache[K, V]) Put(key K, value V) + func (lru *LRUCache[K, V]) Remove(key K) bool + type LinkedList struct + func NewLinkedList[T any](entries ...T) *LinkedList[T] + func (list *LinkedList[T]) AddBack(entry T) + func (list *LinkedList[T]) AddFront(entry T) + func (list *LinkedList[T]) Enumerate(ctx context.Context) Enumerator[T] + func (list *LinkedList[T]) Get(pos uint) (T, bool) + func (list *LinkedList[T]) IsEmpty() bool + func (list *LinkedList[T]) Length() uint + func (list *LinkedList[T]) PeekBack() (T, bool) + func (list *LinkedList[T]) PeekFront() (T, bool) + func (list *LinkedList[T]) RemoveBack() (T, bool) + func (list *LinkedList[T]) RemoveFront() (T, bool) + func (list *LinkedList[T]) Sort(comparator Comparator[T]) error + func (list *LinkedList[T]) String() string + func (list *LinkedList[T]) Swap(x, y uint) error + func (list *LinkedList[T]) ToSlice() []T + type List struct + func NewList[T any](entries ...T) *List[T] + func (l *List[T]) Add(entries ...T) + func (l *List[T]) AddAt(pos uint, entries ...T) + func (l *List[T]) Enumerate(ctx context.Context) Enumerator[T] + func (l *List[T]) Get(pos uint) (T, bool) + func (l *List[T]) IsEmpty() bool + func (l *List[T]) Length() uint + func (l *List[T]) Remove(pos uint) (T, bool) + func (l *List[T]) Set(pos uint, val T) bool + func (l *List[T]) String() string + func (l *List[T]) Swap(x, y uint) bool + type Predicate func(T) bool + type Queue struct + func NewQueue[T any](entries ...T) *Queue[T] + func (q *Queue[T]) Add(entry T) + func (q *Queue[T]) Enumerate(ctx context.Context) Enumerator[T] + func (q *Queue[T]) IsEmpty() bool + func (q *Queue[T]) Length() uint + func (q *Queue[T]) Next() (T, bool) + func (q *Queue[T]) Peek() (T, bool) + func (q *Queue[T]) ToSlice() []T + type Stack struct + func NewStack[T any](entries ...T) *Stack[T] + func (stack *Stack[T]) Enumerate(ctx context.Context) Enumerator[T] + func (stack *Stack[T]) IsEmpty() bool + func (stack *Stack[T]) Peek() (T, bool) + func (stack *Stack[T]) Pop() (T, bool) + func (stack *Stack[T]) Push(entry T) + func (stack *Stack[T]) Size() uint + type Transform func(T) E + func Identity[T any]() Transform[T, T] + type Unfolder func(T) Enumerator[E] Other modules containing this package github.com/marstr/collection