sets

package
v2.0.1 Latest Latest
Warning

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

Go to latest
Published: Aug 30, 2023 License: Apache-2.0 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 struct {
	// contains filtered or unexported fields
}

Set is a very basic implementation for a Set data structure.

func NewSet

func NewSet() *Set

NewSet creates an empty Set.

func Union

func Union(s1, s2 *Set) *Set

Union creates a Set from the union of two.

func (*Set) Add

func (s *Set) Add(items ...string)

Add items to the Set.

func (*Set) Each

func (s *Set) Each(f func(item string) bool)

Each traverses the items in the Set, calling the provided function for each Set member. Traversal will continue until all items in the Set have been visited, or if the closure returns false.

func (*Set) Has

func (s *Set) Has(item string) bool

Has returns true if it contains the item.

func (*Set) IsEmpty

func (s *Set) IsEmpty() bool

IsEmpty returns true if the set has no items.

func (*Set) List

func (s *Set) List() []string

List returns the list of items of the Set.

func (*Set) Merge

func (s *Set) Merge(another *Set)

Merge with items from another set.

func (*Set) Size

func (s *Set) Size() int

Size returns the number if items in the Set.

Jump to

Keyboard shortcuts

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