A fast, generic, and type-safe collections library for Go.
- Type-safe, generic implementations using Go 1.18+ generics
- Minimal memory overhead and optimized performance
- Modular design with consistent APIs and optional capacity preallocation
- Thread-safe variants where appropriate
A simple, non-thread-safe hash set.
- Backed by
map[T]struct{} - Operations:
Add,Remove,Contains,IsEmpty,Size,Clear,ToSlice,ForEach - Optional:
WithCapacity
Thread-safe version of HashSet.
- Uses
sync.RWMutexfor concurrent access - Same API as
HashSet - Optional:
WithCapacity
An optimized FIFO queue with internal shifting and reallocation.
- Fast
Enqueue,Dequeue, andLengthoperations - Avoids unnecessary allocations with shifting and shrinking
- Optional:
WithCapacity
Simple LIFO stack.
- Operations:
Push,Pop,Peek,Length,IsEmpty,Reset - Optional:
WithCapacity
go get github.com/fgrzl/collectionsGuides: docs/ — overview, getting started