sets

package
v0.2.17 Latest Latest
Warning

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

Go to latest
Published: Aug 7, 2024 License: Apache-2.0 Imports: 1 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Add

func Add[T comparable](s Set[T], x T)

Add specified element to set.

func Contains

func Contains[T comparable](s Set[T], x T) bool

Check if set contains specified element.

func Delete

func Delete[T comparable](s Set[T], x T)

Delete specified element from set.

func Equal

func Equal[T comparable](s Set[T], t Set[T]) bool

Compare two sets.

func Len

func Len[T comparable](s Set[T]) int

Get number of elements in the set.

func Values

func Values[T comparable](s Set[T]) []T

Get values of set as slice; order is not predictable. Will return an empty non-nil slice in case the set is empty.

Types

type Set

type Set[T comparable] struct {
	// contains filtered or unexported fields
}

Set. Always create sets with the New() function, do not use unininizialized sets (i.e. sets having the zero value).

func Clone added in v0.2.0

func Clone[T comparable](s Set[T]) Set[T]

Clone set.

func New

func New[T comparable](x ...T) Set[T]

Create new set.

Jump to

Keyboard shortcuts

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