sets

package
v0.1.26 Latest Latest
Warning

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

Go to latest
Published: Jan 7, 2026 License: MIT Imports: 0 Imported by: 0

Documentation

Overview

Package sets provides a simple implementation of a set data structure.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Empty

type Empty struct{}

Empty is used to indicate the value in a set.

type String

type String map[string]Empty

String is a set of strings.

func NewString

func NewString(items ...string) String

NewString creates a new String set and inserts the given items.

func StringKeySet

func StringKeySet[useless any](m map[string]useless) String

StringKeySet creates a String set from the keys of the given map.

func (String) Delete

func (s String) Delete(items ...string)

Delete removes items from the set.

func (String) Has

func (s String) Has(item string) bool

Has checks if the set contains the item.

func (String) HasAll

func (s String) HasAll(items ...string) bool

HasAll checks if the set contains all the items.

func (String) HasAny

func (s String) HasAny(items ...string) bool

HasAny checks if the set contains any of the items.

func (String) Insert

func (s String) Insert(items ...string)

Insert adds items to the set.

func (String) Intersection

func (s String) Intersection(other String) String

Intersection returns a new set that is the intersection of the two sets.

func (String) List

func (s String) List() []string

List returns the items in the set as a slice.

Jump to

Keyboard shortcuts

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