set

package module
v1.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 8, 2025 License: MIT Imports: 3 Imported by: 2

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])

Documentation

Overview

Package set implements a generic set type. Finally! https://en.wikipedia.org/wiki/Set_(mathematics)

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Set

type Set[T comparable] map[T]struct{}

func FromSeq

func FromSeq[T comparable](seq iter.Seq[T]) (result Set[T])

func Make

func Make[T comparable](size int) Set[T]

func Of

func Of[T comparable](items ...T) (result Set[T])

func (Set[T]) Add

func (s Set[T]) Add(items ...T) Set[T]

func (Set[T]) AddIter added in v1.2.0

func (s Set[T]) AddIter(it iter.Seq[T]) Set[T]

func (Set[T]) All

func (s Set[T]) All() iter.Seq[T]

func (Set[T]) Clear

func (s Set[T]) Clear() Set[T]

func (Set[T]) Contains

func (s Set[T]) Contains(item T) bool

func (Set[T]) Difference

func (s Set[T]) Difference(that Set[T]) (result Set[T])

func (Set[T]) Empty

func (s Set[T]) Empty() bool

func (Set[T]) Equal

func (s Set[T]) Equal(that Set[T]) bool

func (Set[T]) Intersection

func (s Set[T]) Intersection(that Set[T]) (result Set[T])

func (Set[T]) IsSubset

func (s Set[T]) IsSubset(that Set[T]) bool

func (Set[T]) IsSuperset

func (s Set[T]) IsSuperset(that Set[T]) bool

func (Set[T]) Len

func (s Set[T]) Len() int

func (Set[T]) Remove

func (s Set[T]) Remove(items ...T) Set[T]

func (Set[T]) RemoveIter added in v1.2.0

func (s Set[T]) RemoveIter(it iter.Seq[T]) Set[T]

func (Set[T]) Slice

func (s Set[T]) Slice() (result []T)

func (Set[T]) SymmetricDifference

func (s Set[T]) SymmetricDifference(that Set[T]) (result Set[T])

func (Set[T]) Union

func (s Set[T]) Union(that Set[T]) (result Set[T])

Directories

Path Synopsis
internal
should
Package should info: github.com/mdwhatcott/[email protected] (a little copy-paste is better than a little dependency) AUTO-GENERATED: 2023-01-16 10:47:35.113741 -0700 MST m=+0.000358543
Package should info: github.com/mdwhatcott/[email protected] (a little copy-paste is better than a little dependency) AUTO-GENERATED: 2023-01-16 10:47:35.113741 -0700 MST m=+0.000358543

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL