chezmoiset

package
v2.47.4 Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2024 License: MIT Imports: 0 Imported by: 0

Documentation

Overview

Package chezmoiset implements a generic set type.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Set

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

A Set is a set of elements.

func New

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

New returns a new set containing elements.

func NewWithCapacity

func NewWithCapacity[T comparable](capacity int) Set[T]

NewWithCapacity returns a new empty set with the given capacity.

func (Set[T]) Add

func (s Set[T]) Add(elements ...T)

Add adds elements to s.

func (Set[T]) AddSet

func (s Set[T]) AddSet(other Set[T])

AddSet adds all elements from other to s.

func (Set[T]) AnyElement

func (s Set[T]) AnyElement() T

AnyElement returns an arbitrary element from s. It is typically used when s is known to contain exactly one element.

func (Set[T]) Contains

func (s Set[T]) Contains(element T) bool

Contains returns true if s contains element.

func (Set[T]) Elements

func (s Set[T]) Elements() []T

Elements returns all the elements of s.

func (Set[T]) Remove

func (s Set[T]) Remove(elements ...T)

Remove removes elements from s.

Jump to

Keyboard shortcuts

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