setutil

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Apr 14, 2023 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Set

type Set[T comparable] struct {
	Set map[T]bool
}

Set is a set of Ts

func NewSet

func NewSet[T comparable]() Set[T]

NewSSet creates a new initialized Set

func (*Set[T]) Add

func (set *Set[T]) Add(s T) bool

Add an element to a set

func (*Set[T]) AddRange

func (set *Set[T]) AddRange(ss []T)

AddRange adds a list of elements to a set

func (*Set[T]) Contains

func (set *Set[T]) Contains(s T) bool

Contains tests if an element is in a set

func (*Set[T]) ContainsAny

func (set *Set[T]) ContainsAny(ss []T) bool

ContainsAny checks if any of the elements exist

func (*Set[T]) Length

func (set *Set[T]) Length() int

Length returns the length of the Set

func (*Set[T]) Stringify

func (set *Set[T]) Stringify() string

Stringify the set

Jump to

Keyboard shortcuts

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