mapset

package
v0.0.15 Latest Latest
Warning

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

Go to latest
Published: Sep 23, 2025 License: MIT Imports: 1 Imported by: 4

Documentation

Overview

Package mapset provides a set implementation using map[T]struct{}

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MapSet

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

MapSet is a set of T

func From

func From[T comparable](vs ...T) MapSet[T]

From creates a new set initialized with the provided values.

func FromSeq added in v0.0.14

func FromSeq[T comparable](vs iter.Seq[T]) MapSet[T]

func (MapSet[T]) Add

func (ms MapSet[T]) Add(v T)

Add a value to the set

func (MapSet[T]) Equals

func (ms MapSet[T]) Equals(o MapSet[T]) bool

Equals returns whether or not two sets have the same items

func (MapSet[T]) Has

func (ms MapSet[T]) Has(v T) bool

Has returns whether the set has the item

func (MapSet[T]) Slice

func (ms MapSet[T]) Slice() []T

Slice returns a slice of the set's items in no particular order

func (MapSet[T]) Subtract

func (ms MapSet[T]) Subtract(o MapSet[T])

Subtract updates ms to not include members of o

Jump to

Keyboard shortcuts

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