Documentation ¶
Overview ¶
Example ¶
package main import ( "fmt" "github.com/bangumi/server/internal/pkg/generic/set" ) func main() { s := set.New[string]() s.Add("foo") s.Add("bar") s.Add("baz") fmt.Println(s.Has("foo")) fmt.Println(s.Has("quux")) }
Output: true false
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Set ¶
type Set[T comparable] struct { // contains filtered or unexported fields }
Set is a not thread-safe set based on built-in map.
func FromSlice ¶
func FromSlice[T comparable](in []T) Set[T]
func New ¶
func New[T comparable]() Set[T]
func (Set[T]) Intersection ¶
Intersection return a new set = (s1 & s2).
Click to show internal directories.
Click to hide internal directories.