set

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Oct 21, 2021 License: ISC Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type HashSet

type HashSet struct {
	// contains filtered or unexported fields
}

HashSet is a simple Set structure.

func NewHashSet

func NewHashSet(items []string) *HashSet

NewHashSet creates and returns a new HashSet items is a list of initial set members.

func (*HashSet) Add

func (h *HashSet) Add(item string)

Add adds an item to the HashSet.

func (*HashSet) Clear

func (h *HashSet) Clear()

Clear empties the HashSet.

func (*HashSet) Contains

func (h *HashSet) Contains(item string) bool

Contains returns set membership of item in the HashSet.

func (*HashSet) Copy

func (h *HashSet) Copy() *HashSet

Copy returns a new copy of the HashSet.

func (*HashSet) Count

func (h *HashSet) Count() int

Count returns the current count of items

func (*HashSet) Del

func (h *HashSet) Del(item string)

Del removes item from the HashSet.

func (*HashSet) Difference

func (h *HashSet) Difference(s *HashSet) *HashSet

Difference returns a new HashSet which contains the result of subtracting s from the HashSet

func (*HashSet) Intersection

func (h *HashSet) Intersection(s *HashSet) *HashSet

Intersection returns the set intersection with s as a new set

func (*HashSet) Items

func (h *HashSet) Items() []string

Items returns the items as a slice

func (*HashSet) Union

func (h *HashSet) Union(s *HashSet) *HashSet

Union returns the set union with s as a new set

Jump to

Keyboard shortcuts

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