go get github.com/squarehole/genericlist
Compatibility: go >= 1.21
a versatile and type-safe generic list for any type that implements the 'comparable' contract, which allows for comparisons using
func CreateList() {
list := &GenericList[int]{}
list.New()
list.Add(1)
list.Add(2)
list.Add(3)
// Increment the value of every item in the list with 1
list.ForEach(func(i *int) { *i++ })
}
- Ping me on mastodon @jvanrhyn (DMs, mentions, whatever :))
- Fork the project
- Fix open issues or request new features
Don't hesitate ;)
# Install some dev dependencies
make tools
# Run tests
make test
# or
make watch-test
Give a βοΈ if this project helped you!
Copyright Β© 2023 Johan van Rhyn.
This project is MIT licensed.