A lightweight, idiomatic and extensible collection of data structures in Go.
Treje aims to provide clean implementations of common data structures not available in the Go standard library — starting with Set & MapSet.
✅ Set implementation
✅ MapSet implementation
✅ Operations:
- Manipulation:
Add,Remove,Discard,Pop - Set operations:
Union,Intersection,Difference,SymmetricDifference IsSubsetOf,Equals
✅ Utilities:
Has()IsEmpty()Clear()Min()&Max()Sum()(numbers) orConcat(separator)(string)Sort()&ReverseSort()Copy()ToSlice()
go get github.com/rojack96/trejeA := treje.NewSet().Int8(1, 2, 3)
A.Add(4)
B := treje.NewSet().Int8(3, 4, 5)
diff := A.Difference(B) // [1 2]
fmt.Println("Difference:", diff)- Set
- MapSet (Set backed by map for performance)
- Stack
- Queue
- Deque
- Linked List
- Tree structures (BST, AVL, etc.)
- Graph
- Priority Queue / Heap
- Idiomatic Go
- Datatype first
- No external dependencies
- Generic-friendly (Go 1.18+ ready)
- Focus on clarity and correctness
- Simple API surface
MIT License