sets

package
v0.0.0-...-9d022b6 Latest Latest
Warning

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

Go to latest
Published: Aug 21, 2025 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Package sets provides utility functions for working with sets.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Clone

func Clone[V comparable](s set.Set[V]) set.Set[V]

Clone returns a copy of the set.

func Collect

func Collect[V comparable](seq iter.Seq[V]) set.Set[V]

Collect collects all values from the sequence into a new set.

func Difference

func Difference[V comparable](s1, s2 set.Set[V]) set.Set[V]

Difference returns a new set with all values from s1 that are not in s2.

func Equal

func Equal[V comparable](s1, s2 set.Set[V]) bool

Equal returns true if the two sets are equal.

func HasAll

func HasAll[V comparable](s set.Set[V], seq iter.Seq[V]) bool

HasAll returns true if the set contains all values in the given sequence.

func HasAny

func HasAny[V comparable](s set.Set[V], seq iter.Seq[V]) bool

HasAny returns true if the set contains any value in the given sequence.

func Insert

func Insert[V comparable](s set.Set[V], seq iter.Seq[V])

Insert inserts all values from the sequence into the set.

func Pop

func Pop[V comparable](s set.Set[V]) (V, bool)

Pop removes and returns an arbitrary value from the set. The second return value is false if the set is empty.

func TryCollect

func TryCollect[V comparable](seq iter.Seq2[V, error]) (set.Set[V], error)

TryCollect collects all values from the sequence into a new set. It returns the first error encountered.

func TryInsert

func TryInsert[V comparable](s set.Set[V], seq iter.Seq2[V, error]) error

TryInsert inserts all values from the sequence into the set. It returns the first error encountered.

func Union

func Union[V comparable](s1, s2 set.Set[V]) set.Set[V]

Union returns a new set with all values from s1 and s2.

func Values

func Values[V comparable](s set.Set[V]) iter.Seq[V]

Values returns a sequence of the values in the set.

Types

This section is empty.

Jump to

Keyboard shortcuts

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