sets

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Jul 27, 2023 License: MIT Imports: 1 Imported by: 0

Documentation

Overview

package sets is used to provide set like functionality for the library.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Set

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

Set is a set of comparable elements.

func NewSet

func NewSet[E comparable](vals ...E) Set[E]

NewSet creates a new set.

func (Set[E]) Add

func (s Set[E]) Add(vals ...E)

Add adds elements to the set.

func (Set[E]) Contains

func (s Set[E]) Contains(v E) bool

Contains returns true if the set contains the element.

func (Set[E]) Intersection

func (s Set[E]) Intersection(s2 Set[E]) Set[E]

Intersection returns the intersection of two sets.

func (Set[E]) Members

func (s Set[E]) Members() []E

Members returns the members of the set.

func (Set[E]) Remove

func (s Set[E]) Remove(vals ...E)

Remove deletes elements from the set.

func (Set[E]) String

func (s Set[E]) String() string

String implements the Stringer interface.

func (Set[E]) Union

func (s Set[E]) Union(s2 Set[E]) Set[E]

Union returns the union of two sets.

Jump to

Keyboard shortcuts

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