set

package
v1.0.5 Latest Latest
Warning

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

Go to latest
Published: Sep 13, 2020 License: BSD-3-Clause Imports: 2 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Interface

type Interface interface {
	// Add element to the set
	Add(interface{})

	//Remove element from the set
	Remove(interface{})

	// CopyTo another set
	CopyTo(other Interface)

	// Returns the union set with other set
	Union(other Interface) Interface

	// Returns the intersection set with other set
	Intersection(other Interface) Interface

	// Is current set subset (contained in) of the provided set
	IsSubsetOf(other Interface) bool

	// Is current set superset of the provided set
	IsSupersetOf(other Interface) bool

	// Returns true if set contains the element, -1, false otherwise
	Contains(interface{}) bool

	// Size of the set
	Size() int

	// Creates a slice from the set
	ToSlice() []interface{}

	// Initializes the set from slice
	FromSlice([]interface{})
}

type Set

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

Set is implementation of set.Interface Comparisons to match elements are based on KeyFunc

func NewSet

func NewSet(keyFunc lib.KeyFunc) *Set

func (*Set) Add

func (s *Set) Add(elem interface{})

func (*Set) Contains

func (s *Set) Contains(elem interface{}) bool

func (*Set) CopyTo

func (s *Set) CopyTo(other Interface)

func (*Set) FromSlice

func (s *Set) FromSlice(input []interface{})

func (*Set) Intersection

func (s *Set) Intersection(other Interface) Interface

func (*Set) IsSubsetOf

func (s *Set) IsSubsetOf(other Interface) bool

func (*Set) IsSupersetOf

func (s *Set) IsSupersetOf(other Interface) bool

func (*Set) Remove

func (s *Set) Remove(elem interface{})

func (*Set) Size

func (s *Set) Size() int

func (*Set) ToSlice

func (s *Set) ToSlice() []interface{}

func (*Set) Union

func (s *Set) Union(other Interface) Interface

type SliceSet added in v1.0.5

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

func NewSliceSet added in v1.0.5

func NewSliceSet(kf lib.KeyFunc) *SliceSet

func (*SliceSet) Add added in v1.0.5

func (ss *SliceSet) Add(it interface{})

func (SliceSet) ContainsKeyFor added in v1.0.5

func (ss SliceSet) ContainsKeyFor(it interface{}) bool

func (SliceSet) GetItemForKey added in v1.0.5

func (ss SliceSet) GetItemForKey(it interface{}) interface{}

func (SliceSet) GetSlice added in v1.0.5

func (ss SliceSet) GetSlice() []interface{}

func (*SliceSet) Remove added in v1.0.5

func (ss *SliceSet) Remove(it interface{})

Jump to

Keyboard shortcuts

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