Skip to content

Latest commit

 

History

History
42 lines (31 loc) · 1.06 KB

README.md

File metadata and controls

42 lines (31 loc) · 1.06 KB

go-hashset

Go CI CodeQL

A go library hashset for O(1)

Example

Initialize set and Add element

import (
	...
	hashset "github.com/1eedaegon/go-hashset"
	...
)

	s := hashset.New(1, 2, "3")
	s.Add("3") // Since "3" already exists in the Set, its size remains 3.

Remove and Distinguish between different types

import (
	...
	hashset "github.com/1eedaegon/go-hashset"
	...
)
    s := hashset.New("1", "2", 3)
	s.Remove("1")
	s.Remove("multiple")
	s.Remove("3") // The length of s is 2, because due to the difference in types.

Other case doc: https://pkg.go.dev/github.com/1eedaegon/go-hashset

License

MIT