set

package
v0.0.0-...-6b6cd0b Latest Latest
Warning

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

Go to latest
Published: Nov 1, 2022 License: MIT Imports: 0 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 {
	// contains filtered or unexported fields
}

Generic Set data structure implemention.

func New

func New[T comparable](initial ...T) *Set[T]

Create a new set

func (*Set[T]) Difference

func (s *Set[T]) Difference(set *Set[T]) *Set[T]

Find the difference between two sets

func (*Set[T]) ForEach

func (s *Set[T]) ForEach(f func(elem T))

Call f for each item in the set

func (*Set[T]) Has

func (s *Set[T]) Has(element T) bool

Test to see whether or not the element is in the set

func (*Set[T]) Insert

func (s *Set[T]) Insert(element T)

Add an element to the set

func (*Set[T]) Intersection

func (s *Set[T]) Intersection(set *Set[T]) *Set[T]

Find the intersection of two sets

func (*Set[T]) Len

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

Return the number of items in the set

func (*Set[T]) ProperSubsetOf

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

Test whether or not this set is a proper subset of "set"

func (*Set[T]) Remove

func (s *Set[T]) Remove(element T)

Remove an element from the set

func (*Set[T]) SubsetOf

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

Test whether or not this set is a subset of "set"

func (*Set[T]) Union

func (s *Set[T]) Union(set *Set[T]) *Set[T]

Find the union of two sets

Jump to

Keyboard shortcuts

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