Basic Generic Collections Library for Golang with interfaces to provide implementation-agnostic abstractions
over various collections
go get github.com/golanglibs/gocollections@latest-
- Encompasses all collections implemented in this library
- Provides the following operations:
Size() intEmpty() boolAdd(element T) boolRemove(element T) boolContains(element T) boolForEach(do func(*T))
- Implemented By:
-
- Provides operations for list-like collections
- Provides the following operations:
SetEqualityComparer(equals func(*T, *T) bool):At(index int) *TSet(index int, value T)Size() intEmpty() boolFront() *TBack() *TAdd(element T) boolRemoveBack()Insert(index int, value T) boolAddToFront(element T)RemoveFront()Remove(element T) boolRemoveAt(index int)IndexOf(element T) intContains(element T) boolSubList(start int, end int) Lister[T]Clear()ForEach(do func(*T))
- Implemented by:
-
- Provides operations for set-like collections
- Provides the following operations:
Size() intEmpty() boolAdd(element K) boolRemove(element K) boolContains(element K) boolEquals(set Seter[K]) boolIntersects(set Seter[K]) boolGetIntersection(set Seter[K]) Seter[K]GetUnion(set Seter[K]) Seter[K]IsSupersetOf(set Seter[K]) boolIsSubsetOf(set Seter[K]) boolClear()ForEach(do func(*K))
- Implemented By:
-
- Provides operations for queue-like collections
- Provides the following operations
SetEqualityComparer(equals func(*T, *T) bool)Size() intEmpty() boolEnqueue(element T)Dequeue()Peek() *TContains(element T) boolClear()ForEach(do func(*T))
- Implemented By:
- LinkedListQueue
- PriorityQueue - Binary Heap
-
- Provides operations for stack-like collections
- Provides the following operations:
SetEqualityComparer(equals func(*T, *T) bool)Size() intEmpty() boolPush(T)Pop()Peek() *TContains(element T) boolClear()ForEach(do func(*T))
- Implemented By:
- Add
SortedMap (TreeMap)andSortedSet (TreeSet) - Add
Stream APIsusingCollectioner - Add more collection methods such as
MapandFilter