hashset

package
v0.0.0-...-7a468ce Latest Latest
Warning

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

Go to latest
Published: Feb 24, 2026 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type HashSet

type HashSet[H comparable, V any] struct {
	// contains filtered or unexported fields
}

HashSet is a generic set data structure.

func New

func New[H comparable, V any](hash func(V) H, equal func(V, V) bool) *HashSet[H, V]

New creates a new set from the given values.

func (*HashSet[H, V]) Delete

func (s *HashSet[H, V]) Delete(vs ...V) *HashSet[H, V]

Delete removes the given values from the set.

func (*HashSet[H, V]) Has

func (s *HashSet[H, V]) Has(v V) bool

Has returns true if the set contains the given value.

func (*HashSet[H, V]) Insert

func (s *HashSet[H, V]) Insert(vs ...V) *HashSet[H, V]

Insert adds the given values to the set.

func (*HashSet[H, V]) Len

func (s *HashSet[H, V]) Len() int

Len returns the length of the set.

func (*HashSet[H, V]) Values

func (s *HashSet[H, V]) Values() iter.Seq[V]

Values returns an iterator over all values in the set.

Jump to

Keyboard shortcuts

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