set

package
v1.1.4 Latest Latest
Warning

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

Go to latest
Published: Feb 8, 2021 License: MIT Imports: 2 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Equal

func Equal(a *Set, b *Set) bool

Equal compare two set is equal

Types

type Set

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

Set struct

func Difference

func Difference(a *Set, b *Set) *Set

Difference two sets: a - b

func Intersect

func Intersect(a *Set, b *Set) *Set

Intersect two sets: a ∩ b

func NewSet

func NewSet(data ...any) *Set

NewSet return a pointer to a set and init it using the slice

func Union

func Union(a *Set, b *Set) *Set

Union two sets: a ∪ b

func (*Set) Add

func (s *Set) Add(data any) bool

Add the data to the set, return whether add successfully

func (*Set) Clear

func (s *Set) Clear(data any)

Clear the data from the set

func (*Set) Copy

func (s *Set) Copy() *Set

Copy the set

func (*Set) Difference

func (s *Set) Difference(s2 *Set) *Set

Difference two sets: a - b

func (*Set) Equal

func (s *Set) Equal(s2 *Set) bool

Equal compare two set is equal

func (*Set) Exist

func (s *Set) Exist(data any) bool

Exist return the data exist in the set

func (*Set) Intersect

func (s *Set) Intersect(s2 *Set) *Set

Intersect two sets: a ∩ b

func (*Set) Len

func (s *Set) Len() int

Len the set

func (*Set) String

func (s *Set) String() string

String of the set

func (*Set) Union

func (s *Set) Union(s2 *Set) *Set

Union two sets: a ∪ b

Jump to

Keyboard shortcuts

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