set

package
v2.4.0 Latest Latest
Warning

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

Go to latest
Published: Oct 19, 2024 License: MIT Imports: 3 Imported by: 1

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

Jump to

Keyboard shortcuts

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