zuint16set

package
v0.12.0 Latest Latest
Warning

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

Go to latest
Published: Dec 9, 2023 License: MIT Imports: 1 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
}

func New

func New(items ...uint16) (s *Set)

Create a new set with the given items

func NewIntersection

func NewIntersection(sets ...*Set) *Set

Create a new set that is the intersection of all provided sets

func NewUnion

func NewUnion(sets ...*Set) (s *Set)

Create a new set that is the union of all provided sets

func (*Set) Add

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

Add items to the set

func (*Set) Clear

func (s *Set) Clear() *Set

Remove all items from the set

func (*Set) Clone

func (s *Set) Clone() *Set

Return a new set that contains the same items as the original

func (*Set) Complement

func (s *Set) Complement(others ...*Set) *Set

Complement removes items that are not in the other sets. This mutates the set.

func (*Set) Contains

func (s *Set) Contains(items ...uint16) bool

Check if the set contains all of the given items

func (*Set) ContainsAny

func (s *Set) ContainsAny(items ...uint16) bool

Check if the set contains any of the given items

func (*Set) Delete

func (s *Set) Delete(items ...uint16) *Set

Delete items from the set

func (*Set) Equal

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

Equal returns if boths sets contain the same items

func (*Set) Filter

func (s *Set) Filter(f func(uint16) bool) *Set

Filter removes all items from the set that do not match the given filter function. This mutates the set.

func (*Set) FilterItems

func (s *Set) FilterItems(f func(uint16) bool) (res []uint16)

FilterItems returns a slice of items from the set that match the given filter function.

func (*Set) Intersection

func (s *Set) Intersection(others ...*Set) *Set

Intersection will reduce this set to the items that are present in this set and the other sets. This mutates the set.

func (*Set) Items

func (s *Set) Items() (res []uint16)

Items returns a slice with the items of the set

func (*Set) Size

func (s *Set) Size() int

Size returns the size of the set

func (*Set) Union

func (s *Set) Union(others ...*Set) *Set

Union adds all the items of the other sets to this set. This mutates the set.

Jump to

Keyboard shortcuts

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