Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/mdw-go/set
A generic set type for Go (finally!)
https://github.com/mdw-go/set
Last synced: 22 days ago
JSON representation
A generic set type for Go (finally!)
- Host: GitHub
- URL: https://github.com/mdw-go/set
- Owner: mdw-go
- License: other
- Created: 2023-01-16T17:52:09.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2024-10-19T07:11:32.000Z (about 1 month ago)
- Last Synced: 2024-10-20T10:23:41.399Z (29 days ago)
- Language: Go
- Size: 26.4 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# github.com/mdw-go/set/v2
package set // import "github.com/mdw-go/set/v2/set"
Package set implements a generic set type. Finally!
https://en.wikipedia.org/wiki/Set_(mathematics)
TYPES
type Set[T comparable] map[T]struct{}
func FromSeq[T comparable](seq iter.Seq[T]) (result Set[T])
func Make[T comparable](size int) Set[T]
func Of[T comparable](items ...T) (result Set[T])
func (s Set[T]) Add(items ...T) Set[T]
func (s Set[T]) All() iter.Seq[T]
func (s Set[T]) Clear() Set[T]
func (s Set[T]) Contains(item T) bool
func (s Set[T]) Difference(that Set[T]) (result Set[T])
func (s Set[T]) Empty() bool
func (s Set[T]) Equal(that Set[T]) bool
func (s Set[T]) Intersection(that Set[T]) (result Set[T])
func (s Set[T]) IsSubset(that Set[T]) bool
func (s Set[T]) IsSuperset(that Set[T]) bool
func (s Set[T]) Len() int
func (s Set[T]) Remove(items ...T) Set[T]
func (s Set[T]) Slice() (result []T)
func (s Set[T]) SymmetricDifference(that Set[T]) (result Set[T])
func (s Set[T]) Union(that Set[T]) (result Set[T])