layeredsets

package
v0.0.0-...-8f1101b Latest Latest
Warning

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

Go to latest
Published: Nov 26, 2024 License: Apache-2.0 Imports: 3 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type String

type String []sets.Set[string]

String is a layered set implemented as a slice of sets.Set[string].

func NewString

func NewString(items ...string) String

NewString creates a String from a list of values.

func NewStringFromSlices

func NewStringFromSlices(items ...[]string) String

NewStringFromSlices creates a String from a list of sets.

func (String) Delete

func (s String) Delete(items ...string)

Delete removes all items from the set.

func (String) Difference

func (s String) Difference(s2 sets.Set[string]) String

Difference returns a set of objects that are not in s2

func (String) Equal

func (s String) Equal(s2 String) bool

Equal returns true if and only if s1 is equal (as a set) to s2.

func (String) Has

func (s String) Has(item string) bool

Has returns true if and only if item is contained in the set.

func (*String) Insert

func (s *String) Insert(layerID int, items ...string)

Insert adds items to the set.

func (String) Len

func (s String) Len() int

Len returns the size of the set.

func (String) List

func (s String) List() []string

List returns the contents as a sorted string slice, respecting layers.

func (String) PopRandom

func (s String) PopRandom() string

PopRandom randomly selects an element and pops it.

func (String) Set

func (s String) Set() sets.Set[string]

Set converts the multiset into a regular sets.Set[string] for compatibility.

func (String) Union

func (s String) Union(s2 String) String

Union returns a new set which includes items in either s1 or s2.

func (String) UnsortedList

func (s String) UnsortedList() []string

UnsortedList returns the slice with contents in random order, respecting layers.

Jump to

Keyboard shortcuts

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